diff --git a/multi/multi__gatewayfilter_factories.html b/multi/multi__gatewayfilter_factories.html index f330eb7d..79ccfe14 100644 --- a/multi/multi__gatewayfilter_factories.html +++ b/multi/multi__gatewayfilter_factories.html @@ -185,7 +185,9 @@ KeyResolver userKeyResolver() { uri: http://example.org filters: - RemoveResponseHeader=X-Response-Foo

-

This will remove the X-Response-Foo header from the response before it is returned to the gateway client.

5.13 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.

application.yml.  +

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.

5.13 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.

application.yml. 

spring:
   cloud:
     gateway:
@@ -322,4 +324,12 @@ using something like class, String.class,
         		    (exchange, s) -> Mono.just(s.toUpperCase()))).uri(uri)
         .build();
-}
\ No newline at end of file +}

5.25 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.  +

spring:
+  cloud:
+    gateway:
+      default-filters:
+      - AddResponseHeader=X-Response-Default-Foo, Default-Bar
+      - PrefixPath=/httpbin

+

\ No newline at end of file diff --git a/multi/multi_spring-cloud-gateway.html b/multi/multi_spring-cloud-gateway.html index 30804d1c..a95d4e28 100644 --- a/multi/multi_spring-cloud-gateway.html +++ b/multi/multi_spring-cloud-gateway.html @@ -1,3 +1,3 @@ - Spring Cloud Gateway

Spring Cloud Gateway


Table of Contents

1. How to Include Spring Cloud Gateway
2. Glossary
3. How It Works
4. Route Predicate Factories
4.1. After Route Predicate Factory
4.2. Before Route Predicate Factory
4.3. Between Route Predicate Factory
4.4. Cookie Route Predicate Factory
4.5. Header Route Predicate Factory
4.6. Host Route Predicate Factory
4.7. Method Route Predicate Factory
4.8. Path Route Predicate Factory
4.9. Query Route Predicate Factory
4.10. RemoteAddr Route Predicate Factory
4.10.1. Modifying the way remote addresses are resolved
5. GatewayFilter Factories
5.1. AddRequestHeader GatewayFilter Factory
5.2. AddRequestParameter GatewayFilter Factory
5.3. AddResponseHeader GatewayFilter Factory
5.4. Hystrix GatewayFilter Factory
5.5. FallbackHeaders GatewayFilter Factory
5.6. PrefixPath GatewayFilter Factory
5.7. PreserveHostHeader GatewayFilter Factory
5.8. RequestRateLimiter GatewayFilter Factory
5.8.1. Redis RateLimiter
5.9. RedirectTo GatewayFilter Factory
5.10. RemoveHopByHopHeadersFilter GatewayFilter Factory
5.11. RemoveRequestHeader GatewayFilter Factory
5.12. RemoveResponseHeader GatewayFilter Factory
5.13. RewritePath GatewayFilter Factory
5.14. RewriteResponseHeader GatewayFilter Factory
5.15. SaveSession GatewayFilter Factory
5.16. SecureHeaders GatewayFilter Factory
5.17. SetPath GatewayFilter Factory
5.18. SetResponseHeader GatewayFilter Factory
5.19. SetStatus GatewayFilter Factory
5.20. StripPrefix GatewayFilter Factory
5.21. Retry GatewayFilter Factory
5.22. RequestSize GatewayFilter Factory
5.23. Modify Request Body GatewayFilter Factory
5.24. Modify Response Body GatewayFilter Factory
6. Global Filters
6.1. Combined Global Filter and GatewayFilter Ordering
6.2. Forward Routing Filter
6.3. LoadBalancerClient Filter
6.4. Netty Routing Filter
6.5. Netty Write Response Filter
6.6. RouteToRequestUrl Filter
6.7. Websocket Routing Filter
6.8. Gateway Metrics Filter
6.9. Marking An Exchange As Routed
7. TLS / SSL
7.1. TLS Handshake
8. Configuration
8.1. Fluent Java Routes API
8.2. DiscoveryClient Route Definition Locator
8.2.1. Configuring Predicates and Filters For DiscoveryClient Routes
9. Reactor Netty Access Logs
10. CORS Configuration
11. Actuator API
11.1. Retrieving route filters
11.1.1. Global Filters
11.1.2. Route Filters
11.2. Refreshing the route cache
11.3. Retrieving the routes defined in the gateway
11.4. Retrieving information about a particular route
11.5. Creating and deleting a particular route
11.6. Recap: list of all endpoints
12. Developer Guide
12.1. Writing Custom Route Predicate Factories
12.2. Writing Custom GatewayFilter Factories
12.3. Writing Custom Global Filters
12.4. Writing Custom Route Locators and Writers
13. Building a Simple Gateway Using Spring MVC or Webflux
\ No newline at end of file + Spring Cloud Gateway

Spring Cloud Gateway


Table of Contents

1. How to Include Spring Cloud Gateway
2. Glossary
3. How It Works
4. Route Predicate Factories
4.1. After Route Predicate Factory
4.2. Before Route Predicate Factory
4.3. Between Route Predicate Factory
4.4. Cookie Route Predicate Factory
4.5. Header Route Predicate Factory
4.6. Host Route Predicate Factory
4.7. Method Route Predicate Factory
4.8. Path Route Predicate Factory
4.9. Query Route Predicate Factory
4.10. RemoteAddr Route Predicate Factory
4.10.1. Modifying the way remote addresses are resolved
5. GatewayFilter Factories
5.1. AddRequestHeader GatewayFilter Factory
5.2. AddRequestParameter GatewayFilter Factory
5.3. AddResponseHeader GatewayFilter Factory
5.4. Hystrix GatewayFilter Factory
5.5. FallbackHeaders GatewayFilter Factory
5.6. PrefixPath GatewayFilter Factory
5.7. PreserveHostHeader GatewayFilter Factory
5.8. RequestRateLimiter GatewayFilter Factory
5.8.1. Redis RateLimiter
5.9. RedirectTo GatewayFilter Factory
5.10. RemoveHopByHopHeadersFilter GatewayFilter Factory
5.11. RemoveRequestHeader GatewayFilter Factory
5.12. RemoveResponseHeader GatewayFilter Factory
5.13. RewritePath GatewayFilter Factory
5.14. RewriteResponseHeader GatewayFilter Factory
5.15. SaveSession GatewayFilter Factory
5.16. SecureHeaders GatewayFilter Factory
5.17. SetPath GatewayFilter Factory
5.18. SetResponseHeader GatewayFilter Factory
5.19. SetStatus GatewayFilter Factory
5.20. StripPrefix GatewayFilter Factory
5.21. Retry GatewayFilter Factory
5.22. RequestSize GatewayFilter Factory
5.23. Modify Request Body GatewayFilter Factory
5.24. Modify Response Body GatewayFilter Factory
5.25. Default Filters
6. Global Filters
6.1. Combined Global Filter and GatewayFilter Ordering
6.2. Forward Routing Filter
6.3. LoadBalancerClient Filter
6.4. Netty Routing Filter
6.5. Netty Write Response Filter
6.6. RouteToRequestUrl Filter
6.7. Websocket Routing Filter
6.8. Gateway Metrics Filter
6.9. Marking An Exchange As Routed
7. TLS / SSL
7.1. TLS Handshake
8. Configuration
8.1. Fluent Java Routes API
8.2. DiscoveryClient Route Definition Locator
8.2.1. Configuring Predicates and Filters For DiscoveryClient Routes
9. Reactor Netty Access Logs
10. CORS Configuration
11. Actuator API
11.1. Retrieving route filters
11.1.1. Global Filters
11.1.2. Route Filters
11.2. Refreshing the route cache
11.3. Retrieving the routes defined in the gateway
11.4. Retrieving information about a particular route
11.5. Creating and deleting a particular route
11.6. Recap: list of all endpoints
12. Developer Guide
12.1. Writing Custom Route Predicate Factories
12.2. Writing Custom GatewayFilter Factories
12.3. Writing Custom Global Filters
12.4. Writing Custom Route Locators and Writers
13. Building a Simple Gateway Using Spring MVC or Webflux
\ No newline at end of file diff --git a/single/spring-cloud-gateway.html b/single/spring-cloud-gateway.html index 5b62a57b..668464fd 100644 --- a/single/spring-cloud-gateway.html +++ b/single/spring-cloud-gateway.html @@ -1,6 +1,6 @@ - Spring Cloud Gateway

Spring Cloud Gateway


Table of Contents

1. How to Include Spring Cloud Gateway
2. Glossary
3. How It Works
4. Route Predicate Factories
4.1. After Route Predicate Factory
4.2. Before Route Predicate Factory
4.3. Between Route Predicate Factory
4.4. Cookie Route Predicate Factory
4.5. Header Route Predicate Factory
4.6. Host Route Predicate Factory
4.7. Method Route Predicate Factory
4.8. Path Route Predicate Factory
4.9. Query Route Predicate Factory
4.10. RemoteAddr Route Predicate Factory
4.10.1. Modifying the way remote addresses are resolved
5. GatewayFilter Factories
5.1. AddRequestHeader GatewayFilter Factory
5.2. AddRequestParameter GatewayFilter Factory
5.3. AddResponseHeader GatewayFilter Factory
5.4. Hystrix GatewayFilter Factory
5.5. FallbackHeaders GatewayFilter Factory
5.6. PrefixPath GatewayFilter Factory
5.7. PreserveHostHeader GatewayFilter Factory
5.8. RequestRateLimiter GatewayFilter Factory
5.8.1. Redis RateLimiter
5.9. RedirectTo GatewayFilter Factory
5.10. RemoveHopByHopHeadersFilter GatewayFilter Factory
5.11. RemoveRequestHeader GatewayFilter Factory
5.12. RemoveResponseHeader GatewayFilter Factory
5.13. RewritePath GatewayFilter Factory
5.14. RewriteResponseHeader GatewayFilter Factory
5.15. SaveSession GatewayFilter Factory
5.16. SecureHeaders GatewayFilter Factory
5.17. SetPath GatewayFilter Factory
5.18. SetResponseHeader GatewayFilter Factory
5.19. SetStatus GatewayFilter Factory
5.20. StripPrefix GatewayFilter Factory
5.21. Retry GatewayFilter Factory
5.22. RequestSize GatewayFilter Factory
5.23. Modify Request Body GatewayFilter Factory
5.24. Modify Response Body GatewayFilter Factory
6. Global Filters
6.1. Combined Global Filter and GatewayFilter Ordering
6.2. Forward Routing Filter
6.3. LoadBalancerClient Filter
6.4. Netty Routing Filter
6.5. Netty Write Response Filter
6.6. RouteToRequestUrl Filter
6.7. Websocket Routing Filter
6.8. Gateway Metrics Filter
6.9. Marking An Exchange As Routed
7. TLS / SSL
7.1. TLS Handshake
8. Configuration
8.1. Fluent Java Routes API
8.2. DiscoveryClient Route Definition Locator
8.2.1. Configuring Predicates and Filters For DiscoveryClient Routes
9. Reactor Netty Access Logs
10. CORS Configuration
11. Actuator API
11.1. Retrieving route filters
11.1.1. Global Filters
11.1.2. Route Filters
11.2. Refreshing the route cache
11.3. Retrieving the routes defined in the gateway
11.4. Retrieving information about a particular route
11.5. Creating and deleting a particular route
11.6. Recap: list of all endpoints
12. Developer Guide
12.1. Writing Custom Route Predicate Factories
12.2. Writing Custom GatewayFilter Factories
12.3. Writing Custom Global Filters
12.4. Writing Custom Route Locators and Writers
13. Building a Simple Gateway Using Spring MVC or Webflux

2.1.1.BUILD-SNAPSHOT

This project provides an API Gateway built on top of the Spring Ecosystem, including: Spring 5, Spring Boot 2 and Project Reactor. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency.

1. How to Include Spring Cloud Gateway

To include Spring Cloud Gateway in your project use the starter with group org.springframework.cloud + Spring Cloud Gateway

Spring Cloud Gateway


Table of Contents

1. How to Include Spring Cloud Gateway
2. Glossary
3. How It Works
4. Route Predicate Factories
4.1. After Route Predicate Factory
4.2. Before Route Predicate Factory
4.3. Between Route Predicate Factory
4.4. Cookie Route Predicate Factory
4.5. Header Route Predicate Factory
4.6. Host Route Predicate Factory
4.7. Method Route Predicate Factory
4.8. Path Route Predicate Factory
4.9. Query Route Predicate Factory
4.10. RemoteAddr Route Predicate Factory
4.10.1. Modifying the way remote addresses are resolved
5. GatewayFilter Factories
5.1. AddRequestHeader GatewayFilter Factory
5.2. AddRequestParameter GatewayFilter Factory
5.3. AddResponseHeader GatewayFilter Factory
5.4. Hystrix GatewayFilter Factory
5.5. FallbackHeaders GatewayFilter Factory
5.6. PrefixPath GatewayFilter Factory
5.7. PreserveHostHeader GatewayFilter Factory
5.8. RequestRateLimiter GatewayFilter Factory
5.8.1. Redis RateLimiter
5.9. RedirectTo GatewayFilter Factory
5.10. RemoveHopByHopHeadersFilter GatewayFilter Factory
5.11. RemoveRequestHeader GatewayFilter Factory
5.12. RemoveResponseHeader GatewayFilter Factory
5.13. RewritePath GatewayFilter Factory
5.14. RewriteResponseHeader GatewayFilter Factory
5.15. SaveSession GatewayFilter Factory
5.16. SecureHeaders GatewayFilter Factory
5.17. SetPath GatewayFilter Factory
5.18. SetResponseHeader GatewayFilter Factory
5.19. SetStatus GatewayFilter Factory
5.20. StripPrefix GatewayFilter Factory
5.21. Retry GatewayFilter Factory
5.22. RequestSize GatewayFilter Factory
5.23. Modify Request Body GatewayFilter Factory
5.24. Modify Response Body GatewayFilter Factory
5.25. Default Filters
6. Global Filters
6.1. Combined Global Filter and GatewayFilter Ordering
6.2. Forward Routing Filter
6.3. LoadBalancerClient Filter
6.4. Netty Routing Filter
6.5. Netty Write Response Filter
6.6. RouteToRequestUrl Filter
6.7. Websocket Routing Filter
6.8. Gateway Metrics Filter
6.9. Marking An Exchange As Routed
7. TLS / SSL
7.1. TLS Handshake
8. Configuration
8.1. Fluent Java Routes API
8.2. DiscoveryClient Route Definition Locator
8.2.1. Configuring Predicates and Filters For DiscoveryClient Routes
9. Reactor Netty Access Logs
10. CORS Configuration
11. Actuator API
11.1. Retrieving route filters
11.1.1. Global Filters
11.1.2. Route Filters
11.2. Refreshing the route cache
11.3. Retrieving the routes defined in the gateway
11.4. Retrieving information about a particular route
11.5. Creating and deleting a particular route
11.6. Recap: list of all endpoints
12. Developer Guide
12.1. Writing Custom Route Predicate Factories
12.2. Writing Custom GatewayFilter Factories
12.3. Writing Custom Global Filters
12.4. Writing Custom Route Locators and Writers
13. Building a Simple Gateway Using Spring MVC or Webflux

2.1.1.BUILD-SNAPSHOT

This project provides an API Gateway built on top of the Spring Ecosystem, including: Spring 5, Spring Boot 2 and Project Reactor. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency.

1. How to Include Spring Cloud Gateway

To include Spring Cloud Gateway in your project use the starter with group org.springframework.cloud and artifact id spring-cloud-starter-gateway. See the Spring Cloud Project page for details on setting up your build system with the current Spring Cloud Release Train.

If you include the starter, but, for some reason, you do not want the gateway to be enabled, set spring.cloud.gateway.enabled=false.

[Important]Important

Spring Cloud Gateway is built upon Spring Boot 2.0, Spring WebFlux, @@ -310,7 +310,9 @@ KeyResolver userKeyResolver() { uri: http://example.org filters: - RemoveResponseHeader=X-Response-Foo

-

This will remove the X-Response-Foo header from the response before it is returned to the gateway client.

5.13 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.

application.yml.  +

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.

5.13 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.

application.yml. 

spring:
   cloud:
     gateway:
@@ -447,7 +449,15 @@ using something like class, String.class,
         		    (exchange, s) -> Mono.just(s.toUpperCase()))).uri(uri)
         .build();
-}

6. 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).

6.1 Combined Global Filter and GatewayFilter Ordering

When a request comes in (and matches a Route) the Filtering Web Handler will add all instances of GlobalFilter and all route specific instances of GatewayFilter to a filter chain. This combined filter chain is sorted by the org.springframework.core.Ordered interface, which can be set by implementing the getOrder() method or by using the @Order annotation.

As Spring Cloud Gateway distinguishes between "pre" and "post" phases for filter logic execution (see: How It Works), the filter with the highest precedence will be the first in the "pre"-phase and the last in the "post"-phase.

ExampleConfiguration.java.  +}

5.25 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.  +

spring:
+  cloud:
+    gateway:
+      default-filters:
+      - AddResponseHeader=X-Response-Default-Foo, Default-Bar
+      - PrefixPath=/httpbin

+

6. 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).

6.1 Combined Global Filter and GatewayFilter Ordering

When a request comes in (and matches a Route) the Filtering Web Handler will add all instances of GlobalFilter and all route specific instances of GatewayFilter to a filter chain. This combined filter chain is sorted by the org.springframework.core.Ordered interface, which can be set by implementing the getOrder() method or by using the @Order annotation.

As Spring Cloud Gateway distinguishes between "pre" and "post" phases for filter logic execution (see: How It Works), the filter with the highest precedence will be the first in the "pre"-phase and the last in the "post"-phase.

ExampleConfiguration.java. 

@Bean
 @Order(-1)
 public GlobalFilter a() {
diff --git a/spring-cloud-gateway.xml b/spring-cloud-gateway.xml
index fc5a6c40..f8b428a2 100644
--- a/spring-cloud-gateway.xml
+++ b/spring-cloud-gateway.xml
@@ -717,6 +717,9 @@ KeyResolver userKeyResolver() {
 
 
 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 @@ -1036,6 +1039,22 @@ public RouteLocator routes(RouteLocatorBuilder builder) { .build(); }
+
+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 + +spring: + cloud: + gateway: + default-filters: + - AddResponseHeader=X-Response-Default-Foo, Default-Bar + - PrefixPath=/httpbin + + +
Global Filters