Tomcatエラー:メソッド名に無効な文字が見つかりました。 HTTPメソッド名はトークンである必要があります



Tomcat Error Invalid Character Found Method Name



参考記事:

https://blog.csdn.net/qiaojieqq11/article/details/51437568



https://blog.csdn.net/qq_1017097573/article/details/62235977

Tomcat gives an error: Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level. java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens at org.apache.coyote.http11.InternalInputBuffer.parseRequestLine(InternalInputBuffer.java:140) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1050) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) 1. Tomcat's header buffer size is not enough, just add maxHttpHeaderSize='the size you want (unit bytes)' in server.xml: (Note: modify the location of the 8080 default port) Parameter analysis: maxHttpHeaderSize client Http request, response header limit URIEncoding: URL-encoded character set. The specified code is used to decode the part of the num %xx byte. If not specified, the default is ISO-8859-1. If the Chinese in the uri is not converted to the %xx format by EncodeURL encoding, but the ordinary encoding, that is, the encoding method without adding the extra % character, the final decoding is also ISO-8859-1. enableLookups: Turns off DNS reverse lookup. useBodyEncodingForURI The default value is false. This specifies whether the encoding specified in the contentType is applied to the URI query parameter instead of using URIEncoding. This setting is for compatibility with Tomcat 4.1.x. The encoding specified in the contentType or the encoding explicitly set using the Request.setCharacterEncoding method also applies to the parameters from the URL. 1) This setting applies only to the requested query string. Unlike URIEncoding, it does not affect the path portion of the request URI. 2) If the request character encoding is unknown (not provided by the browser, not by SetCharacterEncodingFilter or similar filter settings using the Request.setCharacterEncoding method), The default encoding is always 'ISO-8859-1'. The URIEncoding setting has no effect on this default value. 2. If it is a SpringBoot project, you need to modify the following in the application.yml file: server: Port: project port # The following parameter is added to solve the problem tomcat: max-http-header-size: 8192 Or springBoot is configured in the application.properties file [server.tomcat.max-http-header-size=8192] 3. It may be because the request protocol is incorrect and needs to be unified into https or http requests.