meirrav
meirrav

Reputation: 771

How to configure jetty max headers size in spring application

I have a spring application that uses jetty server. i need to change the max size of the header in order to send large size headers.

i added jetty to my dependencies like this:

        <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
    </dependency>

can i add a bean that will configure this?

Upvotes: 0

Views: 6337

Answers (2)

Nicus
Nicus

Reputation: 86

Extending the max URL length reuires enlarging the HTTP Header buffer size, both in Tomcat and Jetty.

Using embedded servlet container in Spring Boot this is done setting maxHttpHeaderSize property to an appropriate value.

The current released version of Spring Boot (1.3.x) supports it for Tomcat only, using server.tomcat.max-http-header-size Spring Boot configuration property.

See: https://github.com/spring-projects/spring-boot/blob/1.3.x/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java#L751

The latest Spring Boot version seems to support it for Jetty as well, using server.max-http-header-size, but has not been released yet:

See https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java#L981

Upvotes: 1

Daniel Mikusa
Daniel Mikusa

Reputation: 15051

With Spring Boot, you can configure the embedded Jetty container by following the instructions here.

Upvotes: 1

Related Questions