Set Jetty buffer size (Maven)

Working with large cookies and jetty, you may have faced this error :

2010-03-11 18:18:31.275:WARN::HttpException(413,FULL head,null)

This is because jetty allows only 4ko for HTTP request and response headers. Using large cookies is enough to reach the limit.

To add more room for headers, simply add <headerBufferSize>16384</headerBufferSize> to your connector configuration (16k should be enough).

Full jetty plug-in configuration :
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.0.1.v20091125</version>
<configuration><scanIntervalSeconds>10</scanIntervalSeconds>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
<headerBufferSize>16192</headerBufferSize>
</connector>
</connectors>
</configuration>
</plugin>


  • Dean Laskin

    This was helpful, thanks for posting.

  • James Echmalian

    The headerBufferSize property is deprecated as of Jetty 7.1 and removed in later versions.  Specify instead.

  • http://id.themel.com/ Thomas Themel

    @James Echmalian: I tried requestBufferSize, and the 413s stuck around. I believe the actual property that needs to be set is requestHeaderSize