title: Windows Azure Websites is overriding my 404 and 500 error pages in my node.js app
body: <p>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.</p>
  
  <p>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:</p>
  
  <p><img src="https://i.imgur.com/aYNLk4W.png" alt=""></p>
  
  <p>However, on azure websites it only returns a single line of text:</p>
  
  <blockquote>
    <p>The page cannot be displayed because an internal server error has occurred.</p>
  </blockquote>
  
  <p>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:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
      &lt;system.web&gt;
          &lt;customErrors mode="off" /&gt;
      &lt;/system.web&gt;
      &lt;system.webServer&gt;
          &lt;handlers&gt;
              &lt;add name="iisnode" path="app.js" verb="*" modules="iisnode"/&gt;
          &lt;/handlers&gt;
          &lt;rewrite&gt;
              &lt;rules&gt;
                  &lt;rule name="StaticContent"&gt;
                      &lt;action type="Rewrite" url="public{REQUEST_URI}"/&gt;
                  &lt;/rule&gt;
                  &lt;rule name="DynamicContent"&gt;
                      &lt;conditions&gt;
                          &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/&gt;
                      &lt;/conditions&gt;
                      &lt;action type="Rewrite" url="app.js"/&gt;
                  &lt;/rule&gt;
              &lt;/rules&gt;
          &lt;/rewrite&gt;
          &lt;iisnode
              debuggingEnabled="true"
              devErrorsEnabled="true"
              debuggerPathSegment="debug"
              nodeProcessCommandLine="&amp;quot;%programfiles(x86)%\nodejs\node.exe&amp;quot;"
              logDirectory="..\..\LogFiles\nodejs"
              watchedFiles="*.js;iisnode.yml;node_modules\*;views\*.jade;views\*.ejb;routes\*.js" /&gt;
      &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I'm not sure if <code>iisnode</code> (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?</p>