1

This is the error that I receive :

 INFO: Error parsing HTTP request header
     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:139)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1028)
        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)

How to fix this Error parsing HTTP request header? And at which point its occurring?

Andrei Tigau
  • 2,010
  • 1
  • 6
  • 17
T.Mohanamurali
  • 11
  • 1
  • 2
  • 4
  • can you add some sample code of how you are making the call and trying to parse the header in the api response?Maybe you can take a look at this - https://stackoverflow.com/questions/42218237/java-lang-illegalargumentexception-invalid-character-found-in-method-name-http – soumitra goswami Nov 11 '19 at 11:28
  • the client seems to send illegal characters instead of something like GET, POST etc – f1sh Nov 11 '19 at 11:34
  • Thanks, Now got an idea to solve this. - soumitra goswami – T.Mohanamurali Nov 13 '19 at 07:17

1 Answers1

2

This exception can occur when you try to execute HTTPS request from client on endpoint which isn't HTTPS enabled. Client will encrypt request data when server is expecting raw data.

You are calling local server with http://localhost:8080/foo/bar. Call it with https://localhost:8080/foo/bar. This solves the problem

Suraj Menon
  • 1,486
  • 3
  • 28
  • 50