How to make Apache Tomcat 8.0.41 to resolve a pipe character in a GET URL request?

Here's the error when I try to send a GET request with a URL in my java web application: my local machine url looks like this http: // localhost: 8080 / test? Param1 = 1 | 2 & param2 = 3343434

February 20, 2017 4:51:19 org.apache.coyote.http11.AbstractHttp11 INFO processor process: an error occurred while analyzing the HTTP request header Note: further occurrences of HTTP header analysis errors will be logged at the DEBUG level. java.lang.IllegalArgumentException: Invalid character found in the request target. Valid characters are defined in RFC 7230 and RFC 3986 at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine (AbstractNioInputBuffer.java:283) at org.apache.coyote.http11.AbstractHttp11Processor.process (AbstractHttp11Per101 atorg11porg11porg11porg1. apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process (AbstractProtocol.java:684) at org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun (NioEndpoint.java:1524) at org.apache.tomcat.util.net. NioEndpoint $ SocketProcessor.run (NioEndpoint.java:1480) in java.util.concurrent.ThreadPoolExecutor.runWorker (Unknown source) in java.util.concurrent.ThreadPoolExecutor $ Worker.run (Unknown source) at org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread.java:61) in java.lang.Thread.run (Unknown source)

I would like to ask if this problem can be fixed without changing the version of Apache Tomcat or making changes to my existing code. I was wondering if this Apache Tomcat configuration file can disable or circumvent this check?

+4
source share
2 answers

The last time I hit my head about it. I tried using mod_rewrite in tomcat in urlencode attempt '|' upon entry, but the error persists as it is thrown before it reaches the rewriting mechanism. So no luck. The only two working solutions I found are:

  • Put a proxy in front of your tomcat (nginx), which can scroll up without throwing a reasonable IllegalArgumentException.
  • Tomcat ( IllegalArgumentExceptions pipe). , 8.5.11 IllegalArgumentException, 8.5.5 .
+4
+3

Source: https://habr.com/ru/post/1670272/


All Articles