Tried a variety of methods, seemingly still does not solve the problem, but also learned something, record notes.
Abnormal details:
1, first see the most of that is added in server.xml Connector in maxHttpHeaderSize = "8192" , a set like this.
<Connector port="8080" protocol="HTTP/1.1" maxHttpHeaderSize="8192" connectionTimeout="20000" maxThreads="150" maxSpareThreads="75" redirectPort="8443" />
But I checked the tomcat configuration introduced https://tomcat.apache.org/tomcat-8.5-doc/config/http.html , this property is the default 8192 (8KB), I simply to set maxHttpHeaderSize = "81920" , but seemingly still not solve the problem, the same exception is still there
But these two settings: maxSpareThreads = "75" when I start tomcat will have the following warning, but I did not find this property in the configuration file in tomcat, so I feel good or not set
10-Sep-2019 11:38:15.659 警告 [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxSpareThreads' to '75' did not find a matching property.
2, there are kinds of argument say that the reason is not legitimate to design characters, Error parsing HTTP request header request header translation is wrong thing
The following reference: https://www.jianshu.com/p/83735dc80603?spm=a2c6h.13066369.0.0.44c05da9lfSEG7
First of all: not recommended to reduce tomcat version, which is equal deceiving, absolutely worth the candle.
After Tomcat 7.0.73, 8.0.39, 8.5.7 version, http resolve when done strictly limited.
RFC3986 document specifies, Url request contains only letters (a-zA-Z), numbers (0-9), -_. 1-4 and special characters all reserved characters.
Solution: In conf / catalina.properties add the last two lines:
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
Unfortunately, the requestTargetAllow
only configuration |, {,} allow these three characters, for others (such as "<> [\] ^` {|}.), At the time of the request, still intercept, if you use the | {} other characters other than how to do it? it also requires the following configuration.
relaxedPathChars="[\]^`{|}" relaxedQueryChars="[\]^`{|}"
But after I add this note, there will start the following warning, they did not know what the reason, but my URLs do not have these special symbols, simply delete it, and if there are these special symbols can try.
10-Sep-2019 11:38:15.663 警告 [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'relaxedPathChars' to '[\]^`{|}' did not find a matching property.
10-Sep-2019 11:38:15.663 警告 [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'relaxedQueryChars' to '[\]^`{|}' did not find a matching property.
3, there is a magic solution, says the problem is https, http changed enough, I had to use the http, so do not try this method if this is the case, you can try
4, Modify Connection Agreement
4.1 HTTP1.1 into org.apache.coyote.http11.Http11NioProtocol, the results start tomcat when there was a lot of mistakes "address used", without understanding, medium and large head
Check here to learn a little Linux port of knowledge: Linux view the port occupancy can use lsof and netstat command .
(1) lsof usage:
lsof -i: port number
(2) netstat Usage:
netstat -tunlp | grep port number
netstat command various parameters as follows:
-a: lists all the network status, including Socket program;
-c Seconds: Specifies the network every few seconds to refresh the state;
-n: Use IP address and port number is displayed, not using a domain name with the service name;
-p: display PID and program name;
-t: display port connection using the TCP protocol status;
-u: UDP protocol to use display port connection status;
the -I: displays the connection status monitor;
-r: displays the routing table;
you can display the current All ports and service process on the server, in conjunction with grep to view a specific port and service cases ·
(3) kill the process
kill -9 PID
4.2 HTTP1.1 changed protocol = "org.apache.coyote.http11.Http11Protocol", suggesting this wording is obsolete when you start, make use of a protocol on
10-Sep-2019 14:55:12.963 警告 [main] org.apache.coyote.http11.Http11Protocol.<init> The HTTP BIO connector has been removed in Tomcat 8.5.x onwards. The HTTP BIO connector configuration has been automatically switched to use the HTTP NIO connector instead.