Setting Max HTTP Header Size With AJP / Tomcat 6.0

Trott picture Trott · Jul 27, 2011 · Viewed 25.4k times · Source

If you're not using AJP, Tomcat 6.0 Connectors have a nice maxHttpHeaderSize attribute in server.xml. But if you are using AJP, that attribute is not understood. Is there any way to increase the allowed HTTP header size if you are writing an app that is using AJP?

(maxHttpHeaderSize is documented at http://tomcat.apache.org/tomcat-6.0-doc/config/http.html but there is also this in that document: "If you wish to configure the Connector that is used for connections to web servers using the AJP protocol (such as the mod_jk 1.2.x connector for Apache 1.3), see here instead." The "here" link points to http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html where maxHttpHeaderSize is omitted from the list of attributes.)

Answer

Kevin Hakanson picture Kevin Hakanson · Aug 19, 2011

The AJP protocol is packet oriented, and in the Basic Packet Structure section of mod_proxy_ajp it says:

According to much of the code, the max packet size is 8 * 1024 bytes (8K). The actual length of the packet is encoded in the header.

Send Headers has a packet code of 4, so it appears all the headers need to fit in a single packet with a 8k limit. However, if How to set the AJP packet size in Tomcat? is correct, you can increase that limit.