Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iisnode and custom http errors #295

Closed
rnikitin opened this issue Sep 13, 2013 · 5 comments
Closed

iisnode and custom http errors #295

rnikitin opened this issue Sep 13, 2013 · 5 comments

Comments

@rnikitin
Copy link

Hi, we are building a REST API and we want to return any error and fault HTTP state with JSON body, contains error description. And we are deploying to Windows Azure WebSites.

Example code:

app.get("/error1", function(req, res){
    res.json(503, {desc: "something went wrong.", errcode: 1101});
});

We discovered, that iisnode handles this errors and rewrites the body.
Is there a way to prevent it from doing this?

@rnikitin
Copy link
Author

Guys, any suggestions? @tjanczuk?

@spanditcaa
Copy link

Here's what we use:

web.config:

  <configuration>
    <system.web>
      <customErrors mode="off" />
    </system.web>
    <system.webServer>
      <httpErrors existingResponse="passthrough" />

   ...

then in a startup command -

%windir%\system32\inetsrv\appcmd delete module CustomErrorModule

@tjanczuk
Copy link
Owner

+1. This is actually IIS behavior, not iisnodes. Turning off IIS custom errors and setting the passthrough for the body should be sufficient.

@rnikitin
Copy link
Author

Thanks, guys! This works very well even without deleting CustomErrorModule.
Could we put this somewhere in the wiki?

@pcomerford
Copy link

pcomerford commented Jul 27, 2017

So, in case anyone out there is applying the <httpErrors existingResponse="passthrough" /> fix, be sure to try <httpErrors existingResponse="PassThrough" /> as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants