【解決策】The valid characters are defined in RFC 7230 and RFC 3986

2572 ワード

【私の質問】tomcat-7.0.104バージョンを使用してwarパッケージを起動し、Postmanでgetリクエストを送信し、バックグラウンドで無効な文字を報告します.
Jul 17, 2020 11:16:19 AM org.apache.coyote.http11.AbstractHttp11Processor process
INFO: Error parsing HTTP request header
 Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the request target [/AppHttpServer/childServlet?resultMsg=jQuery110207745351287510183_1593847521419&data={%22personBirthday%22:%222009-01-23%22,%22personName%22:%22%22,%22personCardno%22:%222009242180%22,%22personNo%22:%22%22,%22logo%22:%22phone%22,%22wxinId%22:%22oDlo2t1NknzCrLea_6D5JRi4I0Cc%22}]. 
The valid characters are defined in RFC 7230 and RFC 3986 at org.apache.coyote.http11.InternalInputBuffer.parseRequestLine(InternalInputBuffer.java:213) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1108) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:654) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:317) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)

 
【解決策】$TOMCAT_HOME/conf/catalina.propertiesを変更し、属性tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}を追加
Springbootプロジェクトの場合、SpringBootApplicationのmainメソッドにSystemを追加することができます.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow","|{}");
 
参照>>>Invalid character found in the request targetを解決します.The valid characters are defined in RFC 7230 and RFC問題