Increase or remove content length restrictions in Spring-Boot's embedded Netty

How do I configure the embedded Netty in spring-boot to not have a content length limit?

It is currently not possible. See reactor-netty #223 and Spring Framework #16228.


Analysis:

Turns out that Netty apparently has a content length maximum

The limitation comes from reactor-netty, not directly from Netty.

The limit comes from reactor. ... .WebsocketInbound, a Java interface which will aggregate up to 65,536 bytes per frame.

I could find only one class that implements WebsocketInbound: HttpServerWSOperations. This class doesn't change the default method WebsocketInbound.aggregateFrames so the limit of 65k bytes remains.

HttpServerWSOperations is used by the final method HttpServerOperations.withWebsocketSupport and it is instantiated directly, so you can not change the implementation.


It is now possible using the following boms:

dependencyManagement {
  imports {
    mavenBom("org.springframework.boot:spring-boot-dependencies:2.2.2.RELEASE")
    mavenBom("org.springframework.cloud:spring-cloud-dependencies:Hoxton.RELEASE") 
  }
}

And then in your gateway application config you can set:

spring.cloud.gateway.httpclient.websocket.max-frame-payload-length: <bytes_new_limit>

I was struggling with this for a while, my spring boot was on '2.1.10.RELEASE'. They fixed it in the new version of webflux that comes with those managed dependencies.