【Tomcat】已解决:java.lang.IllegalArgumentException: 在请求目标中找到无效字符有效字符在RFC 7230和RFC 3986中定义

【Tomcat】已解决java.lang.IllegalArgumentException: 在请求目标中找到无效字符。有效字符在RFC 7230和RFC 3986中定义

[http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service 解析 HTTP 请求 header 错误
 注意:HTTP请求解析错误的进一步发生将记录在DEBUG级别。
    java.lang.IllegalArgumentException: 在请求目标中找到无效字符。有效字符在RFC 7230和RFC 3986中定义
        at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:509)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:511)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1650)
        at org.apache.tomcat.util.net.socketProcessorBase.run(SocketProcessorBase.java:49)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
        
        
        
方案一、
Tomcat官网给出的方案:
http://tomcat.apache.org/tomcat-8.0-doc/config/systemprops.html

tomcat.util.http.parser.HttpParser. requestTargetAllow
    
This system property is deprecated. Use the relaxedpathChars and relaxedQueryChars attributes of the Connector instead. These attributes permit a wider range of characters to be configured as valid.

A string comprised of characters the server should allow even when they are not encoded. These characters would normally result in a 400 status.

The acceptable characters for this property are: |, { , and }

WARNING: Use of this option may expose the server to CVE-2016-6816.

If not specified, the default value of null will be used.


方案二、
修改server.xml 配置

tomcat --> conf--> server.xml 

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
               URIEncoding="utf-8" relaxedpathChars="|{}[],%"
               relaxedQueryChars="|{}[],%"
               />

相关文章

一 、安装solr 环境说明:centos 7.3,solr 6.6,zookeeper3...
tomcat 日志说明 配置文件server.xml 默认日志格式为 推荐使...
在实际生产环境中,tomcat的 catalina.out日志默认是不切割的...
简介: SSL 协议的3个特性: 保密:通过SSL链接传输的数据是...
遵循Java Servlet 规范第4节中的建议 ,Apache Tomcat实现了...