INFO: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Request header is too large
at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:512)
at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:501)
at org.apache.coyote.http11.InternalInputBuffer.parseRequestLine(InternalInputBuffer.java:171)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:996)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:722
How could I solve this in my spring web application?
I had gone through this thread Request header is too large
Solved!
I was using HTTP GET instead of HTTP POST.
Technically I have seen HttpGet will have issue if the URL length goes beyond 2000 characters. In that case, it's better to use HttpPost or split the URL.
Browsers have limits ranging on the 2kb - 8kb
Tomcat: Request header Too large
I know it is an old post. However I think it is good to clarify some bits.
- Using _server.tomcat.max-http-header-size=max_wanted_size_ parameter you will change the server to accept up to max_wanted_size, but even if you set that to 10Mb the browser will cut your request param to the browser limit size. I have tried in chrome and it seems to be around 150-200kb.
- The java.lang.IllegalArgumentException is happening in the server and it hasn't any to do with the browser. Hence, changing server.tomcat.max-http-header-size should be good enough and it is happening when using GET method but it can also happen when using POST method (In the POST case maxPostSize parameter should be changed).
here is the question, is there any limit in HTTP headers? The Answer is No.
there is no limit but web-servers are limiting their incoming request header size even in POST requests therefore we getting 413 (Request header is too large). This limitation is including request line and header fields.
http://httpd.apache.org/docs/2.2/mod/core.html#limitrequestfieldsize
https://tomcat.apache.org/tomcat-5.5-doc/config/http.html
http://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers
Maximum on http header values?
In my case, I had SpringBoot 1.5.8 and used HTTP POST, however I had to add:
server.max-http-header-size=10000000
in application.properties.
It's not about POST or GET but rather what is the header size limit setup for the Tomcat used by your application.
You can always control and configure that using app properties as below:
server.tomcat.max-http-header-size=1024
Where 1024 is in Bytes.