Tomcat Http请求报错 终极解决方案: Invalid character found in the request target. The valid characters are defined in RFC 3986
问题现象
信息 [http-nio-8087-exec-5] org.apache.coyote.http11.Http11Processor.service 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
解决办法
在conf/catalina.properties修改:
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
如还不行,在conf/server.xml中的<Connector>节点中,添加2个属性:
relaxedPathChars="|{}