Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Windows Azure Websites is overriding my 404 and 500 error pages in my node.js app

Windows Azure Websites is overriding my 404 and 500 error pages in my node.js app

Problem

I am using Windows Azure Websites to host a node.js application. So far everything is great except for my custom errors. In my node app I have an error handler that renders a custom 404 and custom 500 error page just fine on my local machine. However, as soon as I publish to azure it overrides the response when I set the statusCode to anything except 200.

If I don't pass the 500 or 404 statusCode to the response then this does not happen, but I do want the status codes to make it to the browser. Locally I get my custom error page just fine:

However, on Azure Websites it only returns a single line of text:

The page cannot be displayed because an internal server error has occurred.

I tried creating my own web.config to override the default one with custom errors disabled but that didn't seem to have any effect. Here is my web.config:

I'm not sure if iisnode (the extension for iis that routes requests to node.js) is responsible for overriding my error pages or if iis itself is responsible. Any suggestions?

Problem courtesy of: Chev

Solution

Well nevermind, I found the issue. If anyone else is having the same problem simply add the following under in web.config:

Solution courtesy of: Chev

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Windows Azure Websites is overriding my 404 and 500 error pages in my node.js app

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×