The previous project has been using TOMCAT6 but for some reason the Tomcat 7 Discovery pass JSON parameter will appear
Using the protocol= "http/1.1" connector (Coyote) after upgrading a site to Tomcat 7.0.73 from 7.0.72 or from anything Earli Er, a URL with an unencoded {or} (ie. http://my.com?filter={"search": "IsValid"}), now returns a, error code and logs The following error message: "Info:error parsing http request Header Note:further occurrences of HTTP header parsing err ORS is logged at DEBUG level.java.lang.IllegalArgumentException:Invalid character found in the request target. The valid characters is defined in RFC 7230 and RFC 3986 "
After Baidu, tried a variety of methods, have no effect. Like what
TOMCAT7 the JSON string in the incompatible URL of the version above, the lower version of Tomcat can be replaced (not recommended)
The parameters can be resolved by URL transcoding by the JS method "encodeURIComponent (param)", as follows:
var myurl = ' [{"ItemId": "2", "SkuId": ""}] '; var myotherurl = "Http://localhost:8080/cart/batchremove?data=" + encodeURIComponent (Myurl);
Later saw a blog, suggested that you refer to the original text: 77963622
According to the RFC specification, special characters such as |,{,} are not allowed in the URL, but some URLs may carry these characters in actual production, especially | is still more common. After Tomcat upgraded to 7, the check for URL characters became stricter, and if such characters were present, Tomcat would return a 400 status code directly.
Later, some people put forward the different meanings, see: https://bz.apache.org/bugzilla/show_bug.cgi?id=60594
After a bargain, the Tomcat developer adds a setting that allows the configuration of special characters that can appear in URLs, but is limited to |,{,} three, see: http://tomcat.apache.org/tomcat-8.0-doc/config/ Systemprops.html#other
This setting is valid in the following versions of Tomcat:
-8.5.x for 8.5.12 onwards
-8.0.x for 8.0.42 onwards
-7.0.x for 7.0.76 onwards
Workaround:
Find the last line of Config/catalina.properties, remove the comment and #
add one at the end{}
#tomcat. util.http.parser.httpparser.requesttargetallow=| Instead: tomcat.util.http.parser.httpparser.requesttargetallow=| {}
Tomcat 7 cannot pass the JSON solution