I am building an application for which i am using nodejs express to do rest api services. I hosted that application on windows server 2012 using iisnode module.Everything works perfect. The issue is that when i am returning 404(unauthorized) message from node application the end point is recieving the 401 http status with the error page of iis. Is there any other way to overcome this issue.
here is my webconfig file
<!-- indicates that the hello.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<!-- use URL rewriting to redirect the entire branch of the URL namespace
to hello.js node.js application; for example, the following URLs will
all be handled by hello.js:
http://localhost/node/express/myapp/foo
http://localhost/node/express/myapp/bar
-->
<rewrite>
<rules>
<rule name="/">
<match url="/*" />
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
My code in nodejs app is the following
if(clienttoken!=servertoken)
{
res.json(401, 'unauthorized');
res.end();
}
Thanks in advance