iisnode
iisnode copied to clipboard
Reponse body not delivered for 400 errors
On localhost a 400 error returns the following expected response -
{"code":400,"error":"Bad Request","message":"the value of firstName is not allowed to be empty, the value of lastName is not allowed to be empty, the value of profession is not allowed to be empty, the value of nationality is not allowed to be empty, the value of countryOfQualification is not allowed to be empty, the value of contactNumber is not allowed to be empty, the value of emailAddress is not allowed to be empty"}
Remotely, I get this -
Bad Request
I am using the body for validation (well HAPI is). If it the body is not returned I can't do that.
Here is my web.config, is there a way to get the body as node returns it through iisnode on a remote machine?
Regards, Sean
You can work around this by adding an entry to web.config, see http://stackoverflow.com/a/15145477/259808
So, adding <httpErrors existingResponse="PassThrough"></httpErrors> to my web.config fixes my issue with 400 responses from Node, but I have a new problem. Now, when IIS gets a 500 from Node, because it cannot connect to node for some reason, IIS does not serve up our pretty 500.html page. It simply says "Internal Server error" in plain black and white text. We want our users to see a friendly web page in this case.
Is it possible to tell IIS to serve up the response body for 400 responses only?
You can check he details of error in the iisnode
folder located at the root folder of your node application. Which looks like as shown in the image.