javaspring-boottomcat

Error parsing HTTP request header Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level


Using Spring Boot 3.5.4, I am facing the below issue. My request contains Arabic characters in query param, for example: 2/أ. Everything works fine when there is no Arabic character, like this: 2/2. I tried to intercept the request before reaching controller but failed. Before reaching interceptor I got the below error.

2025-08-07T07:48:19.599Z  INFO 1 --- [mock-data] [nio-8080-exec-2] o.apache.coyote.http11.Http11Processor   : Error parsing HTTP request header
 Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.

java.lang.IllegalArgumentException: Invalid character found in the request target [/api/v1/abc/xyz/mock?idNo=2/0xd80xa3 ]. The valid characters are defined in RFC 7230 and RFC 3986
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:478) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:271) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:903) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1769) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1189) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:658) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[tomcat-embed-core-10.1.43.jar!/:na]
    at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
2025-08-07T10:48:19.603290857+03:00

Solution

  • Thank you everyone for your responses. After further investigation, I discovered that there was a proxy in front of the application that was altering the query parameters. Once I identified the presence of the proxy, I tested the service both way, with and without proxy.

    1. Without the proxy, everything worked as expected.

    2. But with the proxy, the request failed.

    Upon failure above logs appeared in the application logs. We have since adjusted the proxy configuration to ensure it no longer modifies the requests.