LoginSignup
5

More than 3 years have passed since last update.

[] を含むURLをGETしようとするとTomcatが400を返す

Posted at

ログ

5 17, 2019 10:24:27 午前 org.apache.coyote.http11.AbstractHttp11Processor process
情報: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

Tomcatのバージョン

$ /opt/tomcat/bin/version.sh
Server version: Apache Tomcat/7.0.91

7.0.76あたりからURLに渡せるパラメータの判別が厳密になった模様。

回避方法

relaxedPathChars
relaxedQueryChars
を指定することで回避します。

<Connector port="8080" protocol="HTTP/1.1" maxThreads="1000" enableLookups="false" maxSwallowSize="-1"
               URIEncoding="UTF-8"
               connectionTimeout="20000"
               redirectPort="8443"
               relaxedPathChars="[]|" relaxedQueryChars="[]|{}^\`" />

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
5