How to Forcefully Redirect HTTP 400 Error in Windo

2019-08-12 01:10发布

问题:

I want to know How to Forcefully Redirect the Error Page for HTTP 400 Bad Request Error in Windows Server HTTP.SYS or IIS levels ,As per my knowledge IIS supporting greater than 400 only,, Is there any Core level way is there for HTTP 400. Bad Request Error Redirection?. or getting some call back from http.sys kernel if 400 error occurs?

Update Notes:
-- As per TechNet Art, cannot customize the following HTTP errors: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505 in IIS

-- Peter Quest: For Me Response is coming from Server:Microsoft-HTTPAPI/2.0

回答1:

It seems you are quoting from a TechNet article:

You cannot customize the following HTTP error messages: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505.

This is only true if the response comes from http.sys, you can tell by looking at the response headers:

Server:Microsoft-HTTPAPI/2.0

comes from http.sys, while IIS sends:

Server:Microsoft-IIS/XX.X

If the response comes from http.sys there is nothing you can do about the error message.

But if the response comes you IIS, you should be able to define a custom error page just like for any other http status.