java.lang.IllegalArgumentException: Invalid character found in the request target. The valid char...

URL请求:

http://localhost:8092/***q={"JDECode":"201911105410005079"}

错误:

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

原因:

1.URL中带了特殊字符。

2.Tomcat在 7.0.73, 8.0.39, 8.5.7 版本后,添加了对于http头的验证,不允许特殊特殊字符。具体来说,就是添加了些规则去限制HTTP头的规范性

解决方式:

在tomcat下conf/catalina.properties 中添加

\# url中允许特殊字符
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}

你可能感兴趣的:(java.lang.IllegalArgumentException: Invalid character found in the request target. The valid char...)