Tomcat升级至7.0.96后报错:The valid characters are defined in RFC 7230 and RFC 3986

问题描述:

问题描述:近期安全整改,要将Tomcat7.0.11 升级至 7.0.96 版本,但是升级之后启动Tomcat发现程序无法访问,且Tomcat出现报错如下:

报错如下

INFO: Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

问题原因

高版本tomcat中的新特性:就是严格按照 RFC 3986规范进行访问解,导致了一下字符问题:
This problem is a new feature in high-version tomcat: access parsing is strictly in accordance with RFC 3986 specification, which defines that only English letters (a-zA-Z), numbers (0-9), -. ~4 special characters and all reserved characters are allowed in Url (RFC 3986 specifies the following characters as reserved characters:!*’).( );: @ &= +$, /?# []. When our system passes through the address, it passes a JSON in the url. Among the parameters it passes in is "{not in the reserved field in RFC3986, so it will report this error.

解决办法:
找到…/conf/catalina.properties
最后一行
#tomcat.util.http.parser.HttpParser.requestTargetAllow=|
改成
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
注意:去掉这行的注释。

发布了36 篇原创文章 · 获赞 46 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_31457413/article/details/98884932
今日推荐