spring-webfluxresponse-headersreactor-netty

WebClient max header size


Is there any way I can configure the max header size for a response?

I get the following error from the netty framework :

io.netty.handler.codec.TooLongFrameException: HTTP header is larger than 8192 bytes.
    at io.netty.handler.codec.http.HttpObjectDecoder$HeaderParser.newException(HttpObjectDecoder.java:983)
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 

Apparently reactor added an API for this, but I don't see how is this controllable in the WebClient of spring Web Flux. I am using the following version

      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
        <version>2.3.2.RELEASE</version>
      </dependency>

Any ideas?


Solution

  • In a Spring Boot app, the max HTTP header size is configured using:

    server.max-http-header-size=65536
    

    I have found this solved the above issue on spring cloud gateway, so worth a try.