简体   繁体   中英

IIS 8.5 400 Bad Request - Invalid URL

I've got request to URL of this kind: https://xxx/test/%81

This results in 400 Bad Request - Invalid URL

I tried to set in web.config:

<httpRuntime requestValidationMode="2.0" relaxedUrlToFileSystemMapping="true" requestPathInvalidCharacters=""/>

But it does not help.

I also tried to use custom request validator:

<httpRuntime requestValidationType="MyNamespace.CustomRequestValidation"/>

But IIS returns 400 before using custom validator.

What else can I do to make IIS to accept this URL?

Thank you.

According to https://www.iis.net/learn/troubleshoot/diagnosing-http-errors/troubleshooting-http-400-errors-in-iis the underlying problem of HTTP 400 is that the client has sent a request to IIS that breaks one or more rules that HTTP.sys is enforcing.

Http.sys registry settings for Windows are dercribed here: https://support.microsoft.com/en-us/kb/820129

So, in my case problem was solved by creating following DWORD values under HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\HTTP\\Parameters as IIS machines:

AllowRestrictedChars = 1
EnableNonUTF8 = 1

After applying these changes to registry IIS machines have to be restarted

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM