tomcat常见问题

1、Invalid character found in the request target [/?a=fetch&content=<php>die(@md5(HelloThinkCMF))</php>]. The valid characters are defined in RFC 7230 and RFC 3986

tomcat版本是8.5.57

解决方法:

Tomcat在 8.5版本后,在http解析时做了严格限制。requestTargetAllow 只能配置|、{、} 这三个字符,对于其他的(例如" < > [ \ ] ^ ` { | } .),依旧报错,如果使用了|{}之外的其他字符,那就还需要如下配置。
1.在tomcat安装路径中conf/catalina.properties中最后添加2行:

tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true

2.在conf/server.xml中的<Connector>节点中,添加2个属性(可以接收任意特殊字符的组合,自行配置):

relaxedPathChars="|{}[],\"
relaxedQueryChars="|{}[],\"

 

posted @ 2020-05-22 10:07  codeg  阅读(746)  评论(0编辑  收藏  举报