Nicolas Richeton's blog

Set Jetty buffer size (Maven)

☕️ 1 min read
logo

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>