As per current implementation (below snippet is from 8.5.28), if the request
header is too large (by default >8K, the default maxHttpHeaderSize), is thrown
below error message is seen.
For request --
02-Nov-2018 15:15:47.649 INFO [catalina-exec-40]
org.apache.coyote.http11.Http11Processor.service 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.Http11InputBuffer.parseHeaders(Http11InputBuffer.java:575)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:703)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
For response—
02-Nov-2018 15:15:47.867 SEVERE [catalina-exec-40]
org.apache.coyote.http11.Http11Processor.endRequest Error finishing response
org.apache.coyote.http11.HeadersTooLargeException: An attempt was made to write
more data to the response headers than there was room available in the buffer.
Increase maxHttpHeaderSize on the connector or write less data into the
response headers.
at
org.apache.coyote.http11.Http11OutputBuffer.checkLengthBeforeWrite(Http11OutputBuffer.java:544)
at
org.apache.coyote.http11.Http11OutputBuffer.write(Http11OutputBuffer.java:481)
at
org.apache.coyote.http11.Http11OutputBuffer.sendStatus(Http11OutputBuffer.java:361)
at
org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1339)
at
org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:260)
at
org.apache.coyote.http11.Http11Processor.endRequest(Http11Processor.java:1523)
However, this doesn’t tell us the name of the offending header which I think is
valuable in debugging the issues.
Do you feel it’s worth the enhancement request?
Also, I noticed the comments
“
// (1) Headers plus request line size does not exceed its limit
// (2) There are enough bytes to avoid expanding the buffer when
// reading body
“
It says request line size ..does that mean maxHttpHeaderSize comes in play for
request line (which includes query params) as well?
Thanks,
Amit