当前位置:网站首页>Invalid character found in request destination. Valid characters are defined in RFC 7230 and RFC 3986

Invalid character found in request destination. Valid characters are defined in RFC 7230 and RFC 3986

2022-06-22 03:47:00 Hu Bayi

problem :

 Insert picture description here
 Insert picture description here

Cause analysis :

Because The log shows that the request address contains illegal characters , appear 400 error

tomcat The higher version strictly follows RFC 3986 Standard resolution address . The specification only allows a-zA-Z 0-9 - _ . ~ And all reserved characters ! * ’ ( ) ; : @ & = + $ , / ? # [ ]

But the item appears in the parameters that initiate the request {}, So we need to configure it

resolvent :

Most used methods on the Internet , take tomcat Medium server.xml Add the following configuration to the file :

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

stay tomcat Make the following configuration in the configuration file , find tomcat The configuration of the server.xml The path is conf Under the folder
 Insert picture description here
 Insert picture description here

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8" relaxedPathChars="|{}[],%" relaxedQueryChars="|{}[],%"/>

Add the code in the red box Problem solving . Or replace the above code .

原网站

版权声明
本文为[Hu Bayi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220327379143.html