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

在用postman访问类似含有特殊字符如[]的时候,报错。

解决方案:

  1、在Tomcat的安装目录中,打开conf/server.xml文件,找到<Connector>节点,增加maxHttpHeaderSize="10240"这个属性,maxHttpHeaderSize默认是8*1024的,改为10*1024,用于增加请求头的长度。

  2、在刚刚的<Connector>标签中,加入relaxedPathChars="|{}[],%" 和 relaxedQueryChars="|{}[],%"即可,其中|后面的字符可以自己随意增减。即:

 保存运行,完美解决!

原文地址:https://www.cnblogs.com/ying1314/p/11818435.html