gpt4 book ai didi

java - 如何修复tomcat org.apache.tomcat.util.http.parser.HttpParser. Character [[] is not allowed and will continue to reject

转载 作者:行者123 更新时间:2023-11-30 07:44:41 25 4
gpt4 key购买 nike

我的请求URL中有字符[],项目部署在Tomcat8.5.33上。当我发布请求时发生了一些异常。

20-Sep-2018 10:55:36.494 WARNING [http-nio-8075-exec-2] org.apache.tomcat.util.http.parser.HttpParser.<clinit> Character [[] is not allowed and will continue to be rejected.
20-Sep-2018 10:55:36.494 WARNING [http-nio-8075-exec-2] org.apache.tomcat.util.http.parser.HttpParser.<clinit> Character []] is not allowed and will continue to be rejected.
20-Sep-2018 10:56:07.083 INFO [http-nio-8075-exec-10] org.apache.coyote.http11.Http11Processor.service 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
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:479)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

最佳答案

Tomcat8.5.33 不允许在 URL 中使用特殊字符,例如 |{}[]。有两种方法可以避免这种错误。

如果您的特殊字符是 |{} 之一,您可以直接添加配置 conf\catalina.properties,如下所示:

tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}

如果你的特殊字符是其他字符,你可以像下面这样配置conf\server.xml:

<Connector port="8075" protocol="HTTP/1.1" relaxedQueryChars='|[]'
connectionTimeout="20000"
redirectPort="8443" />

关于java - 如何修复tomcat org.apache.tomcat.util.http.parser.HttpParser.<clinit> Character [[] is not allowed and will continue to reject,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52417014/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com