Tomcat 400错误

Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

新版本的tomcat对url的参数做了比较规范的限制,必须按照RFC 7230 and RFC 3986规范,对于非保留字字符,如果不做转义处理,一律都会报The valid characters are defined in RFC 7230 and RFC 3986 错误。


org.apache.tomcat.util.http.parser.HttpParser#IS_NOT_REQUEST_TARGET[]中定义了一堆 not request target:


参考解决方法:https://stackoverflow.com/questions/41053653/tomcat-8-is-not-able-to-handle-get-request-with-in-query-parameters


配置tomcat的catalina.properties
添加或者修改:
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}

或者:对参数进行编码!


Tomcat 配置项:https://tomcat.apache.org/tomcat-8.5-doc/config/systemprops.html



%2C : ,            %5C : \

猜你喜欢

转载自blog.csdn.net/u010170616/article/details/80832108