3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Tomcat9 が HTTP Status 400 – Bad Request を返した時の対策

Posted at

次のページを参考にしました。
[] を含むURLをGETしようとするとTomcatが400を返す

ブラウザーで次のようなメッセージが表示された時の対策です。

HTTP Status 400 – Bad Request

Type Exception Report

Message Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

Exception

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

/var/lib/tomcat9/conf/server.xml に
relaxedPathChars と relaxedQueryChars を加えます。

/var/lib/tomcat9/conf/server.xml
(省略)
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
               relaxedPathChars="[]|"
               relaxedQueryChars="[]|{}^\`"
 />
(省略)

再起動

sudo systemctl restart tomcat9

状態の確認

sudo systemctl status tomcat9
3
2
0

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
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?