新版本的tomcat对url的参数做了比较规范的限制,不注意就会掉坑了
- 经验分享
- 时间:2019-05-16 15:08
- 2659人已阅读
简介
Invalidcharacterfoundintherequesttarget.ThevalidcharactersaredefinedinRFC7230andRFC3986新版本的tomcat对url的参数做了比较规范的限制,必须按照RFC7230andRFC3986规范,对于非保留字字符,如果不做转义处理,一律都会报ThevalidcharactersaredefinedinRFC7230an
🔔🔔好消息!好消息!🔔🔔
如果您需要注册ChatGPT,想要升级ChatGPT4。凯哥可以代注册ChatGPT账号,代升级ChatGPT4
有需要的朋友👉:微信号
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