Display Node.js Errors on a Windows IIS Server

Today I was working on a Node server that runs on a Windows server with IIS. I ran into a problem where I wanted my 404 errors to actually send a 404 result with a custom page created in Node. Sending a 404 error made IIS want to display its custom 404 error page though.

I learned you can get around this by adjusting your web.config file. Locate your <system.webServer> settings and add the following snippet: <httpErrors existingResponse="PassThrough" />. This leaves the response untouched if an existing response exists per.

Side note, I highly recommend using the IIS Node package if you are one of the rare people who have to run this setup.

One Last Thing...

If you have a question or see a mistake, please comment below.

If you found this post helpful, please share it with others. It's the best thanks I can ask for & it gives me momentum to keep writing!

Matt Ferderer
Software Developer focused on making great user experiences. I enjoy learning, sharing & helping others make amazing things.
Let's Connect