The valid characters are defined in RFC 7230 and RFC 3986

java.lang.IllegalArgumentException: Invalid character found in the request
target. The valid characters are defined in RFC 7230 and RFC 3986
org.apache.coyote.http11.Http11InputBuffer.parseRequestLine
(Http11InputBuffer.java:467)
org.apache.coyote.http11.Http11Processor.service
(Http11Processor.java:294)
org.apache.coyote.AbstractProcessorLight.process
(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process
(AbstractProtocol.java:791)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
(NioEndpoint.java:1417)
org.apache.tomcat.util.net.SocketProcessorBase.run
(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker
(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run
(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
Note The full stack trace of the root cause is available in the server logs.


Tomcat 7.0.76, 8.0.42, 8.5.12 这些版本之后可以定义requestTargetAllow 属性来允许
禁止的字符。在tomcat的 catalina.properties文件中添加这一句:
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}

如果是springboot工程,
可以在SpringBootApplication的的main方法中增加
System.setProperty
("tomcat.util.http.parser.HttpParser.requestTargetAllow","|{}");

补充:
部署到
tomcat运行到时候,tomcat8.5.30是没有问题的,tomcat8.5.33却出现了同样到问题。
去了
官网文档查看说:tomcat.util.http.parser.HttpParser. requestTargetAllow(This
system property is deprecated. Use the relaxedPathChars and relaxedQueryChars
attributes of the Connector instead)
然后修改server.xml文件,Connector属性修改为
如下:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000"
relaxedQueryChars="[]|{}^&#x5c;&#x60;&quot;&lt;&gt;" redirectPort="8443" />

 

转载于:https://www.cnblogs.com/guanning/p/11104365.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值