添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
3
2

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

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
2