新版本的tomcat对url的参数做了比较规范的限制,不注意就会掉坑了

  • 作者: 凯哥Java(公众号:凯哥Java)
  • 经验分享
  • 时间:2019-05-16 15:08
  • 2637人已阅读
简介 Invalidcharacterfoundintherequesttarget.ThevalidcharactersaredefinedinRFC7230andRFC3986新版本的tomcat对url的参数做了比较规范的限制,必须按照RFC7230andRFC3986规范,对于非保留字字符,如果不做转义处理,一律都会报ThevalidcharactersaredefinedinRFC7230an

🔔🔔好消息!好消息!🔔🔔

 如果您需要注册ChatGPT,想要升级ChatGPT4。凯哥可以代注册ChatGPT账号代升级ChatGPT4

有需要的朋友👉:微信号 kaigejava2022

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 错误。

43a5e532493f3da486623a65744662ec.png

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

1b41dcfc063fe7514fd781f53c20e384.png

参考解决方法: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

1efe0c20e0e31475697eaa2384021faa.png8cccc74702052d149876793b37ce0f54.png

TopTop