0

I am using Tomcat 8. In one case I need to handle external request coming from external source

Tomcat doesnot log the request. In this case I am getting following error.

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:467)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
    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:745)

I want to ask If there is any way I can turn the logging to see which character is causing this issue? Also If I log the request Header, which field in header causes this issue.

I read the thread Tomcat 8 is not able to handle get request with '|' in query parameters?

but adding "tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}" didnt work.

Ravi
  • 30,829
  • 42
  • 119
  • 173
  • 1
    Did you also try to escape them? – tsolakp Feb 01 '18 at 17:04
  • Is the invalid character you're dealing with actually one of `|{}`? I don't know how that solution would help otherwise. If it is not one of those characters, you'll need to follow the other solution recommendations. – Ironcache Feb 01 '18 at 17:10
  • I am trying to identify the the invalid character. Dont know how should I log it. I tried other solution like changing the server.tomcat.uri-encoding=utf-8 It did not work. – Akshay Patil Feb 01 '18 at 18:13
  • @tsolakp How can I escape it ? – Akshay Patil Feb 01 '18 at 18:14

0 Answers0