spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

[Question] Limiting request size

Open bcelenk opened this issue 8 years ago • 1 comments

Hi everybody,

First of all, thank you all for all of your efforts on cloud gateway.

I'm trying to limit the request size on the gateway. I've come across with a similar question on StackOverflow which is concluded by this ongoing PR.

However, the approach in the PR doesn't cover the absence of the Content-Length header, which is not mandatory and the case for chunked requests[content-length represents the chunk's own size, not the total].

I've tried to add HttpObjectAggregator to pipeline after reactor.left.httpCodec. This way works for all requests, however, this approach came with a price. Since aggregator appends all the chunks, io.netty.util.internal.OutOfDirectMemoryError occurred under load.

I wonder what's the best way to restrict requests' size under the circumstances.

Sincerely,

bcelenk avatar Jul 24 '18 15:07 bcelenk

beyond the approach of checking the content-length, I'm not sure. Maybe @violetagg or @smaldini has an idea.

spencergibb avatar Nov 19 '18 18:11 spencergibb