java.lang.IllegalArgumentException:
Invalid character found in the request target.
The valid characters are defined in RFC 7230 and RFC 3986
This exception is caused by passing Chinese words in Get URLs. How can I resolve this issue in tomcat ?
We don't want to reduce the Tomcat version and ask our customer to encode the parameters.
Is there a way to fix this issue by changing configurations in tomcat ?
The valid characters are defined in RFC 7230 and RFC 3986 #12652 java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 @fendo8888 That's not enough information to go on.
The valid characters are defined in RFC 7230 and RFC 3986 #635 Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 #635
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 Since the location had characters which are not recognized. I.e. "C:///" etc, the error was thrown.
The error message says "Invalid character found in the request target". This means the HTTP client sent a request for a resource that had an invalid characters in it. The server can not parse the request because the request did not adhere to the HTTP protocol specifications. This is a client problem.
There is no way to fix this in Tomcat. The requests are not specification compliant so Tomcat will not permit them. There is a long history of security issues around different components in a system reacting differently to such URLs. Usually in the form of header and/or request injection. As a result, Tomcat's URL parsing has been tightened up and it is extremely unlikely it will be relaxed.
httpd is heading in the same direction for the same reasons.
The best long term option is to point out to the clients that the requests they are sending are not specification compliant and that they need to fix them (by using appropriate %nn encoding). On the Tomcat side, make sure Tomcat is using UTF-8. That is the default on newer versions. You might need to explicitly set it on older releases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With