Tomcat server is responding with 400 bad request for this URL

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 18:43:55

问题


I've deployed a static web application using Apache Tomcat 8.5.8

When I call the normal URL, it works fine. http://localhost/example/index.html

But when I call the following URL, it gives me 400 bad request error. http://localhost/example/index.html?host_info=Outlook|Web

I know it's because the URL has the special character (|). But I couldn't configure the Tomcat, because I am pretty new with the Tomcat configuration.

And I can't change the URL, because it's not something I generate. It is from the other component.

So I really need to configure the Tomcat server so that it can accept the url.

Can anyone help me in this?


回答1:


Try to use the tomcat 8.0.* instead of 8.5 I also faced the same issue before, and I had to downgrade the tomcat to 8.0.28




回答2:


This behavior was introduced in Tomcat 7.0.76, 8.0.42 and 8.5.12, to conform RFC 7231.

This enforced check can be revert using the property requestTargetAllow in catalina.properties to allow forbiden characters:

tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}



来源:https://stackoverflow.com/questions/41218574/tomcat-server-is-responding-with-400-bad-request-for-this-url

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