Updates RequestHeaderSize existing filter to also take into account key size

Fixes gh-2536
This commit is contained in:
Marta Medio
2022-03-01 11:16:44 +01:00
committed by spencergibb
parent 0dd2a47d8d
commit ed88edd3a8
3 changed files with 42 additions and 5 deletions

View File

@@ -1143,6 +1143,29 @@ spring:
This will remove the `red` parameter before it is sent downstream.
=== `RequestHeaderSize` `GatewayFilter` Factory
The `RequestHeaderSize` `GatewayFilter` factory takes a `maxSize` parameter.
It is the maximum data size allowed of the request header (incuding key and value).
The following listing configures a `RequestHeaderSize` `GatewayFilter`:
.application.yml
====
[source,yaml]
----
spring:
cloud:
gateway:
routes:
- id: requestheadersize_route
uri: https://example.org
filters:
- RequestHeaderSize=1000B
----
====
This will send a status 431 if size of any request header is greater than 1000 Bytes.
=== The `RewritePath` `GatewayFilter` Factory
The `RewritePath` `GatewayFilter` factory takes a path `regexp` parameter and a `replacement` parameter.