From 17aa11e11935889df817d7458f1681ee3e83cfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20Steen=20M=C3=B8ller?= Date: Mon, 7 Jul 2025 10:10:28 +0200 Subject: [PATCH] Document limitations of RequestSize filter (#3843) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Explain that the `RequestSize` filter only checks the `Content-Length` header (if present), and never the length of the actual request body. Fixes gh-3843 Signed-off-by: Jesper Steen Møller --- .../gatewayfilter-factories/requestsize-factory.adoc | 3 +++ .../filters/requestsize.adoc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/gatewayfilter-factories/requestsize-factory.adoc b/docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/gatewayfilter-factories/requestsize-factory.adoc index 1d0b1b34d4..fc4dcc5327 100644 --- a/docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/gatewayfilter-factories/requestsize-factory.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/gatewayfilter-factories/requestsize-factory.adoc @@ -5,6 +5,9 @@ When the request size is greater than the permissible limit, the `RequestSize` ` The filter takes a `maxSize` parameter. The `maxSize` is a `DataSize` type, so values can be defined as a number followed by an optional `DataUnit` suffix such as 'KB' or 'MB'. The default is 'B' for bytes. It is the permissible size limit of the request defined in bytes. + +WARNING: The `RequestSize` gateway filter only considers the request's `Content-Length`-header and will not restrict requests (using `chunked` transfer encoding or HTTP/2) if `Content-Length` is omitted. + The following listing configures a `RequestSize` `GatewayFilter`: .application.yml diff --git a/docs/modules/ROOT/pages/spring-cloud-gateway-server-webmvc/filters/requestsize.adoc b/docs/modules/ROOT/pages/spring-cloud-gateway-server-webmvc/filters/requestsize.adoc index 7eb84314e0..95f51fdb07 100644 --- a/docs/modules/ROOT/pages/spring-cloud-gateway-server-webmvc/filters/requestsize.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-gateway-server-webmvc/filters/requestsize.adoc @@ -5,6 +5,9 @@ When the request size is greater than the permissible limit, the `RequestSize` f The filter takes a `maxSize` parameter. The `maxSize` is a `DataSize` type, so values can be defined as a number followed by an optional `DataUnit` suffix such as 'KB' or 'MB'. The default is 'B' for bytes. It is the permissible size limit of the request defined in bytes. + +WARNING: The `RequestSize` filter only processes the request's `Content-Length`-header and will not restrict requests (using `chunked` transfer encoding or HTTP/2) if `Content-Length` is omitted. + The following listing configures a `RequestSize` filter: .application.yml