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

前端 未结 3 375
别那么骄傲
别那么骄傲 2021-01-18 02:20
java.lang.IllegalArgumentException: 
Invalid character found in the request target. 
The valid characters are defined in RFC 7230 and RFC 3986

This

3条回答
  •  时光说笑
    2021-01-18 02:50

    It looks like Tomcat, out of the box, will not allow these characters, as you've seen, taking a glance at this question seems to imply you can change this behavior editing your catalina.properties and defining the requestTargetAllow parameter, like the following:

    tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
    

    Unfortunately, it looks like this is just a long list of characters you want to allow, so if you want all chinese characters to be there, you're going to have a pretty long list, per Wikpedia:

    In China, which uses simplified Chinese characters, the Xiàndài Hànyǔ Chángyòng Zìbiǎo (现代汉语常用字表, Chart of Common Characters of Modern Chinese) lists 2,500 common characters and 1,000 less-than-common characters, while the Xiàndài Hànyǔ Tōngyòng Zìbiǎo (现代汉语通用字表, Chart of Generally Utilized Characters of Modern Chinese) lists 7,000 characters, including the 3,500 characters already listed above.

提交回复
热议问题