diff --git a/docs/src/main/asciidoc/spring-cloud-gateway.adoc b/docs/src/main/asciidoc/spring-cloud-gateway.adoc index 63c4af44..a520afaa 100644 --- a/docs/src/main/asciidoc/spring-cloud-gateway.adoc +++ b/docs/src/main/asciidoc/spring-cloud-gateway.adoc @@ -706,6 +706,10 @@ spring: This will remove the `X-Response-Foo` header from the response before it is returned to the gateway client. +To remove any kind of sensitive header you should configure this filter for any routes that you may +want to do so. In addition you can configure this filter once using `spring.cloud.gateway.default-filters` +and have it applied to all routes. + === RewritePath GatewayFilter Factory The RewritePath GatewayFilter Factory takes a path `regexp` parameter and a `replacement` parameter. This uses Java regular expressions for a flexible way to rewrite the request path. @@ -988,6 +992,22 @@ public RouteLocator routes(RouteLocatorBuilder builder) { ---- +=== Default Filters + +If you would like to add a filter and apply it to all routes you can use `spring.cloud.gateway.default-filters`. +This property takes a list of filters + +.application.yml +[source,yaml] +---- +spring: + cloud: + gateway: + default-filters: + - AddResponseHeader=X-Response-Default-Foo, Default-Bar + - PrefixPath=/httpbin +---- + == Global Filters The `GlobalFilter` interface has the same signature as `GatewayFilter`. These are special filters that are conditionally applied to all routes. (This interface and usage are subject to change in future milestones).