In IIS7.5 what module removes the body of a 400 Bad Request

删除回忆录丶 提交于 2019-11-29 03:10:43

Solution: edited the web.config system.webServer section and set httpErrors existingResponse attribute to "PassThrough" et voilá fixed.
ie:

<system.webServer>
    ...
    <httpErrors existingResponse="PassThrough"></httpErrors>
    ...
</system.webServer>

Well 2 things got me think about this issue:
1. the classic CustomErrors behaviour because I was comparing localhost with a remote server
2. the first wouldn't explain how some of my other Authentication 'errors' were getting through intact

I dug around and came across this article on IIS7: How to Use HTTP Detailed Errors in IIS 7.0

It didn't fully pertain to what I found when editing the web.config maybe due me using IIS7.5 but it was enough to get me into the right neighbourhood.

**Also be aware that with IIS 10 now supporting HTTP2, StatusDescriptions that contain text are no longer supported when request upgrade to HTTP2 so if you respond with 400 (Bad Request) this will get stripped to the numeric 400 only. "HTTP/2 does not define a way to carry the version or reason phrase that is included in an HTTP/1.1 status line."

If altering the web.config isn't an option, below may help:

Response.TrySkipIisCustomErrors = true;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!