Sync docs from master to gh-pages
This commit is contained in:
@@ -125,36 +125,35 @@ $(addBlockSwitches);
|
||||
<li><a href="#addresponseheader-gatewayfilter-factory">5.3. AddResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#deduperesponseheader-gatewayfilter-factory">5.4. DedupeResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#hystrix">5.5. Hystrix GatewayFilter Factory</a></li>
|
||||
<li><a href="#spring-cloud-circuitbreaker-filter-factory">5.6. Spring Cloud CircuitBreaker GatewayFilter Factory</a></li>
|
||||
<li><a href="#fallback-headers">5.7. FallbackHeaders GatewayFilter Factory</a></li>
|
||||
<li><a href="#maprequestheader-gatewayfilter-factory">5.8. MapRequestHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#prefixpath-gatewayfilter-factory">5.9. PrefixPath GatewayFilter Factory</a></li>
|
||||
<li><a href="#preservehostheader-gatewayfilter-factory">5.10. PreserveHostHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#requestratelimiter-gatewayfilter-factory">5.11. RequestRateLimiter GatewayFilter Factory</a>
|
||||
<li><a href="#fallback-headers">5.6. FallbackHeaders GatewayFilter Factory</a></li>
|
||||
<li><a href="#maprequestheader-gatewayfilter-factory">5.7. MapRequestHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#prefixpath-gatewayfilter-factory">5.8. PrefixPath GatewayFilter Factory</a></li>
|
||||
<li><a href="#preservehostheader-gatewayfilter-factory">5.9. PreserveHostHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#requestratelimiter-gatewayfilter-factory">5.10. RequestRateLimiter GatewayFilter Factory</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#redis-ratelimiter">5.11.1. Redis RateLimiter</a></li>
|
||||
<li><a href="#redis-ratelimiter">5.10.1. Redis RateLimiter</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#redirectto-gatewayfilter-factory">5.12. RedirectTo GatewayFilter Factory</a></li>
|
||||
<li><a href="#removehopbyhopheadersfilter-gatewayfilter-factory">5.13. RemoveHopByHopHeadersFilter GatewayFilter Factory</a></li>
|
||||
<li><a href="#removerequestheader-gatewayfilter-factory">5.14. RemoveRequestHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#removeresponseheader-gatewayfilter-factory">5.15. RemoveResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#removerequestparameter-gatewayfilter-factory">5.16. RemoveRequestParameter GatewayFilter Factory</a></li>
|
||||
<li><a href="#rewritepath-gatewayfilter-factory">5.17. RewritePath GatewayFilter Factory</a></li>
|
||||
<li><a href="#rewritelocationresponseheader-gatewayfilter-factory">5.18. RewriteLocationResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#rewriteresponseheader-gatewayfilter-factory">5.19. RewriteResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#savesession-gatewayfilter-factory">5.20. SaveSession GatewayFilter Factory</a></li>
|
||||
<li><a href="#secureheaders-gatewayfilter-factory">5.21. SecureHeaders GatewayFilter Factory</a></li>
|
||||
<li><a href="#setpath-gatewayfilter-factory">5.22. SetPath GatewayFilter Factory</a></li>
|
||||
<li><a href="#setrequestheader-gatewayfilter-factory">5.23. SetRequestHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#setresponseheader-gatewayfilter-factory">5.24. SetResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#setstatus-gatewayfilter-factory">5.25. SetStatus GatewayFilter Factory</a></li>
|
||||
<li><a href="#stripprefix-gatewayfilter-factory">5.26. StripPrefix GatewayFilter Factory</a></li>
|
||||
<li><a href="#retry-gatewayfilter-factory">5.27. Retry GatewayFilter Factory</a></li>
|
||||
<li><a href="#requestsize-gatewayfilter-factory">5.28. RequestSize GatewayFilter Factory</a></li>
|
||||
<li><a href="#modify-request-body-gatewayfilter-factory">5.29. Modify Request Body GatewayFilter Factory</a></li>
|
||||
<li><a href="#modify-response-body-gatewayfilter-factory">5.30. Modify Response Body GatewayFilter Factory</a></li>
|
||||
<li><a href="#default-filters">5.31. Default Filters</a></li>
|
||||
<li><a href="#redirectto-gatewayfilter-factory">5.11. RedirectTo GatewayFilter Factory</a></li>
|
||||
<li><a href="#removehopbyhopheadersfilter-gatewayfilter-factory">5.12. RemoveHopByHopHeadersFilter GatewayFilter Factory</a></li>
|
||||
<li><a href="#removerequestheader-gatewayfilter-factory">5.13. RemoveRequestHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#removeresponseheader-gatewayfilter-factory">5.14. RemoveResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#removerequestparameter-gatewayfilter-factory">5.15. RemoveRequestParameter GatewayFilter Factory</a></li>
|
||||
<li><a href="#rewritepath-gatewayfilter-factory">5.16. RewritePath GatewayFilter Factory</a></li>
|
||||
<li><a href="#rewritelocationresponseheader-gatewayfilter-factory">5.17. RewriteLocationResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#rewriteresponseheader-gatewayfilter-factory">5.18. RewriteResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#savesession-gatewayfilter-factory">5.19. SaveSession GatewayFilter Factory</a></li>
|
||||
<li><a href="#secureheaders-gatewayfilter-factory">5.20. SecureHeaders GatewayFilter Factory</a></li>
|
||||
<li><a href="#setpath-gatewayfilter-factory">5.21. SetPath GatewayFilter Factory</a></li>
|
||||
<li><a href="#setrequestheader-gatewayfilter-factory">5.22. SetRequestHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#setresponseheader-gatewayfilter-factory">5.23. SetResponseHeader GatewayFilter Factory</a></li>
|
||||
<li><a href="#setstatus-gatewayfilter-factory">5.24. SetStatus GatewayFilter Factory</a></li>
|
||||
<li><a href="#stripprefix-gatewayfilter-factory">5.25. StripPrefix GatewayFilter Factory</a></li>
|
||||
<li><a href="#retry-gatewayfilter-factory">5.26. Retry GatewayFilter Factory</a></li>
|
||||
<li><a href="#requestsize-gatewayfilter-factory">5.27. RequestSize GatewayFilter Factory</a></li>
|
||||
<li><a href="#modify-request-body-gatewayfilter-factory">5.28. Modify Request Body GatewayFilter Factory</a></li>
|
||||
<li><a href="#modify-response-body-gatewayfilter-factory">5.29. Modify Response Body GatewayFilter Factory</a></li>
|
||||
<li><a href="#default-filters">5.30. Default Filters</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#global-filters">6. Global Filters</a>
|
||||
@@ -851,19 +850,6 @@ If two hops of trusted infrastructure are required before Spring Cloud Gateway i
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="hystrix"><a class="anchor" href="#hystrix"></a><a class="link" href="#hystrix">5.5. Hystrix GatewayFilter Factory</a></h3>
|
||||
<div class="admonitionblock note">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<i class="fa icon-note" title="Note"></i>
|
||||
</td>
|
||||
<td class="content">
|
||||
<a href="https://cloud.spring.io/spring-cloud-netflix/multi/multi__modules_in_maintenance_mode.html">Netflix has put Hystrix in maintenance mode</a>. It is suggested you use the <a href="#spring-cloud-circuitbreaker-filter-factory">Spring Cloud CircuitBreaker
|
||||
Gateway Filter</a> with Resilience4J as support for Hystrix will be removed in a future release.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><a href="https://github.com/Netflix/Hystrix">Hystrix</a> is a library from Netflix that implements the <a href="https://martinfowler.com/bliki/CircuitBreaker.html">circuit breaker pattern</a>.
|
||||
The Hystrix GatewayFilter allows you to introduce circuit breakers to your gateway routes, protecting your services from cascading failures and allowing you to provide fallback responses in the event of downstream failures.</p>
|
||||
@@ -969,125 +955,9 @@ on it in the <a href="#fallback-headers">FallbackHeaders GatewayFilter Factory
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="spring-cloud-circuitbreaker-filter-factory"><a class="anchor" href="#spring-cloud-circuitbreaker-filter-factory"></a><a class="link" href="#spring-cloud-circuitbreaker-filter-factory">5.6. Spring Cloud CircuitBreaker GatewayFilter Factory</a></h3>
|
||||
<h3 id="fallback-headers"><a class="anchor" href="#fallback-headers"></a><a class="link" href="#fallback-headers">5.6. FallbackHeaders GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The Spring Cloud CircuitBreaker filter factory leverages the Spring Cloud CircuitBreaker APIs to wrap Gateway routes in
|
||||
a circuit breaker. Spring Cloud CircuitBreaker supports two libraries which can be used with Spring Cloud Gateway, Hystrix
|
||||
and Resilience4J. Since Netflix has places Hystrix in maintenance only mode we suggest you use Resilience4J.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>To enable the Spring Cloud CircuitBreaker filter you will need to either place <code>spring-cloud-starter-circuitbreaker-reactor-resilience4j</code> or
|
||||
<code>spring-cloud-starter-netflix-hystrix</code> on the classpath.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title">application.yml</div>
|
||||
<div class="content">
|
||||
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">spring:
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
- id: circuitbreaker_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- CircuitBreaker=myCircuitBreaker</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>To configure the circuit breaker, see the configuration for the underlying circuit breaker implementation you are using.</p>
|
||||
</div>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="https://cloud.spring.io/spring-cloud-circuitbreaker/reference/html/spring-cloud-circuitbreaker.html">Resilience4J Documentation</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://cloud.spring.io/spring-cloud-netflix/reference/html/">Hystrix Documentation</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The Spring Cloud CircuitBreaker filter can also accept an optional <code>fallbackUri</code> parameter. Currently, only <code>forward:</code> schemed URIs are supported. If the fallback is called, the request will be forwarded to the controller matched by the URI.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title">application.yml</div>
|
||||
<div class="content">
|
||||
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">spring:
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
- id: circuitbreaker_route
|
||||
uri: lb://backing-service:8088
|
||||
predicates:
|
||||
- Path=/consumingServiceEndpoint
|
||||
filters:
|
||||
- name: CircuitBreaker
|
||||
args:
|
||||
name: myCircuitBreaker
|
||||
fallbackUri: forward:/inCaseOfFailureUseThis
|
||||
- RewritePath=/consumingServiceEndpoint, /backingServiceEndpoint</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title">Application.java</div>
|
||||
<div class="content">
|
||||
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@Bean
|
||||
public RouteLocator routes(RouteLocatorBuilder builder) {
|
||||
return builder.routes()
|
||||
.route("circuitbreaker_route", r -> r.path("/consumingServiceEndpoint")
|
||||
.filters(f -> f.circuitBreaker(c -> c.name("myCircuitBreaker").fallbackUri("forward:/inCaseOfFailureUseThis"))
|
||||
.rewritePath("/consumingServiceEndpoint", "/backingServiceEndpoint")).uri("lb://backing-service:8088")
|
||||
.build();
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>This will forward to the <code>/inCaseofFailureUseThis</code> URI when the circuit breaker fallback is called. Note that this example also demonstrates (optional) Spring Cloud Netflix Ribbon load-balancing via the <code>lb</code> prefix on the destination URI.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The primary scenario is to use the <code>fallbackUri</code> to an internal controller or handler within the gateway app.
|
||||
However, it is also possible to reroute the request to a controller or handler in an external application, like so:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title">application.yml</div>
|
||||
<div class="content">
|
||||
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">spring:
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
- id: ingredients
|
||||
uri: lb://ingredients
|
||||
predicates:
|
||||
- Path=//ingredients/**
|
||||
filters:
|
||||
- name: CircuitBreaker
|
||||
args:
|
||||
name: fetchIngredients
|
||||
fallbackUri: forward:/fallback
|
||||
- id: ingredients-fallback
|
||||
uri: http://localhost:9994
|
||||
predicates:
|
||||
- Path=/fallback</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>In this example, there is no <code>fallback</code> endpoint or handler in the gateway application, however, there is one in another
|
||||
app, registered under <code><a href="http://localhost:9994" class="bare">localhost:9994</a></code>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>In case of the request being forwarded to fallback, the Spring Cloud CircuitBreaker Gateway filter also provides the <code>Throwable</code> that has
|
||||
caused it. It’s added to the <code>ServerWebExchange</code> as the
|
||||
<code>ServerWebExchangeUtils.CIRCUITBREAKER_EXECUTION_EXCEPTION_ATTR</code> attribute that can be used when
|
||||
handling the fallback within the gateway app.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>For the external controller/handler scenario, headers can be added with exception details. You can find more information
|
||||
on it in the <a href="#fallback-headers">FallbackHeaders GatewayFilter Factory section</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="fallback-headers"><a class="anchor" href="#fallback-headers"></a><a class="link" href="#fallback-headers">5.7. FallbackHeaders GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The <code>FallbackHeaders</code> factory allows you to add Hystrix or Spring Cloud CircuitBreaker execution exception details in headers of a request forwarded to
|
||||
<p>The <code>FallbackHeaders</code> factory allows you to add Hystrix execution exception details in headers of a request forwarded to
|
||||
a <code>fallbackUri</code> in an external application, like in the following scenario:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
@@ -1102,7 +972,7 @@ a <code>fallbackUri</code> in an external application, like in the following sce
|
||||
predicates:
|
||||
- Path=//ingredients/**
|
||||
filters:
|
||||
- name: CircuitBreaker
|
||||
- name: Hystrix
|
||||
args:
|
||||
name: fetchIngredients
|
||||
fallbackUri: forward:/fallback
|
||||
@@ -1117,7 +987,7 @@ a <code>fallbackUri</code> in an external application, like in the following sce
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>In this example, after an execution exception occurs while running the circuit breaker, the request will be forwarded to
|
||||
<p>In this example, after an execution exception occurs while running the <code>HystrixCommand</code>, the request will be forwarded to
|
||||
the <code>fallback</code> endpoint or handler in an app running on <code>localhost:9994</code>. The headers with the exception type, message
|
||||
and -if available- root cause exception type and message will be added to that request by the <code>FallbackHeaders</code> filter.</p>
|
||||
</div>
|
||||
@@ -1142,12 +1012,11 @@ their default values:</p>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>For more information of circuit beakers and the Gateway see the <a href="#hystrix">Hystrix GatewayFilter Factory section</a> or
|
||||
<a href="#spring-cloud-circuitbreaker-filter-factory">Spring Cloud CircuitBreaker Factory section</a>.</p>
|
||||
<p>You can find more information on how Hystrix works with Gateway in the <a href="#hystrix">Hystrix GatewayFilter Factory section</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="maprequestheader-gatewayfilter-factory"><a class="anchor" href="#maprequestheader-gatewayfilter-factory"></a><a class="link" href="#maprequestheader-gatewayfilter-factory">5.8. MapRequestHeader GatewayFilter Factory</a></h3>
|
||||
<h3 id="maprequestheader-gatewayfilter-factory"><a class="anchor" href="#maprequestheader-gatewayfilter-factory"></a><a class="link" href="#maprequestheader-gatewayfilter-factory">5.7. MapRequestHeader GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The MapRequestHeader GatewayFilter Factory takes 'fromHeader' and 'toHeader' parameters. It creates a new named header (toHeader) and the value is extracted out of an existing named header (fromHeader) from the incoming http request. If the input header does not exist then the filter has no impact. If the new named header already exists then it’s values will be augmented with the new values.</p>
|
||||
</div>
|
||||
@@ -1169,7 +1038,7 @@ their default values:</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="prefixpath-gatewayfilter-factory"><a class="anchor" href="#prefixpath-gatewayfilter-factory"></a><a class="link" href="#prefixpath-gatewayfilter-factory">5.9. PrefixPath GatewayFilter Factory</a></h3>
|
||||
<h3 id="prefixpath-gatewayfilter-factory"><a class="anchor" href="#prefixpath-gatewayfilter-factory"></a><a class="link" href="#prefixpath-gatewayfilter-factory">5.8. PrefixPath GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The PrefixPath GatewayFilter Factory takes a single <code>prefix</code> parameter.</p>
|
||||
</div>
|
||||
@@ -1191,7 +1060,7 @@ their default values:</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="preservehostheader-gatewayfilter-factory"><a class="anchor" href="#preservehostheader-gatewayfilter-factory"></a><a class="link" href="#preservehostheader-gatewayfilter-factory">5.10. PreserveHostHeader GatewayFilter Factory</a></h3>
|
||||
<h3 id="preservehostheader-gatewayfilter-factory"><a class="anchor" href="#preservehostheader-gatewayfilter-factory"></a><a class="link" href="#preservehostheader-gatewayfilter-factory">5.9. PreserveHostHeader GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The PreserveHostHeader GatewayFilter Factory has no parameters. This filter sets a request attribute that the routing filter will inspect to determine if the original host header should be sent, rather than the host header determined by the http client.</p>
|
||||
</div>
|
||||
@@ -1210,7 +1079,7 @@ their default values:</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="requestratelimiter-gatewayfilter-factory"><a class="anchor" href="#requestratelimiter-gatewayfilter-factory"></a><a class="link" href="#requestratelimiter-gatewayfilter-factory">5.11. RequestRateLimiter GatewayFilter Factory</a></h3>
|
||||
<h3 id="requestratelimiter-gatewayfilter-factory"><a class="anchor" href="#requestratelimiter-gatewayfilter-factory"></a><a class="link" href="#requestratelimiter-gatewayfilter-factory">5.10. RequestRateLimiter GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RequestRateLimiter GatewayFilter Factory is uses a <code>RateLimiter</code> implementation to determine if the current request is allowed to proceed. If it is not, a status of <code>HTTP 429 - Too Many Requests</code> (by default) is returned.</p>
|
||||
</div>
|
||||
@@ -1257,7 +1126,7 @@ spring.cloud.gateway.routes[0].filters[0]=RequestRateLimiter=2, 2, #{@userkeyres
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="redis-ratelimiter"><a class="anchor" href="#redis-ratelimiter"></a><a class="link" href="#redis-ratelimiter">5.11.1. Redis RateLimiter</a></h4>
|
||||
<h4 id="redis-ratelimiter"><a class="anchor" href="#redis-ratelimiter"></a><a class="link" href="#redis-ratelimiter">5.10.1. Redis RateLimiter</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>The redis implementation is based off of work done at <a href="https://stripe.com/blog/rate-limiters">Stripe</a>. It requires the use of the <code>spring-boot-starter-data-redis-reactive</code> Spring Boot starter.</p>
|
||||
</div>
|
||||
@@ -1323,7 +1192,7 @@ KeyResolver userKeyResolver() {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="redirectto-gatewayfilter-factory"><a class="anchor" href="#redirectto-gatewayfilter-factory"></a><a class="link" href="#redirectto-gatewayfilter-factory">5.12. RedirectTo GatewayFilter Factory</a></h3>
|
||||
<h3 id="redirectto-gatewayfilter-factory"><a class="anchor" href="#redirectto-gatewayfilter-factory"></a><a class="link" href="#redirectto-gatewayfilter-factory">5.11. RedirectTo GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RedirectTo GatewayFilter Factory takes a <code>status</code> and a <code>url</code> parameter. The status should be a 300 series redirect http code, such as 301. The url should be a valid url. This will be the value of the <code>Location</code> header.</p>
|
||||
</div>
|
||||
@@ -1345,7 +1214,7 @@ KeyResolver userKeyResolver() {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="removehopbyhopheadersfilter-gatewayfilter-factory"><a class="anchor" href="#removehopbyhopheadersfilter-gatewayfilter-factory"></a><a class="link" href="#removehopbyhopheadersfilter-gatewayfilter-factory">5.13. RemoveHopByHopHeadersFilter GatewayFilter Factory</a></h3>
|
||||
<h3 id="removehopbyhopheadersfilter-gatewayfilter-factory"><a class="anchor" href="#removehopbyhopheadersfilter-gatewayfilter-factory"></a><a class="link" href="#removehopbyhopheadersfilter-gatewayfilter-factory">5.12. RemoveHopByHopHeadersFilter GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RemoveHopByHopHeadersFilter GatewayFilter Factory removes headers from forwarded requests. The default list of headers that is removed comes from the <a href="https://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-14#section-7.1.3">IETF</a>.</p>
|
||||
</div>
|
||||
@@ -1383,7 +1252,7 @@ KeyResolver userKeyResolver() {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="removerequestheader-gatewayfilter-factory"><a class="anchor" href="#removerequestheader-gatewayfilter-factory"></a><a class="link" href="#removerequestheader-gatewayfilter-factory">5.14. RemoveRequestHeader GatewayFilter Factory</a></h3>
|
||||
<h3 id="removerequestheader-gatewayfilter-factory"><a class="anchor" href="#removerequestheader-gatewayfilter-factory"></a><a class="link" href="#removerequestheader-gatewayfilter-factory">5.13. RemoveRequestHeader GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RemoveRequestHeader GatewayFilter Factory takes a <code>name</code> parameter. It is the name of the header to be removed.</p>
|
||||
</div>
|
||||
@@ -1405,7 +1274,7 @@ KeyResolver userKeyResolver() {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="removeresponseheader-gatewayfilter-factory"><a class="anchor" href="#removeresponseheader-gatewayfilter-factory"></a><a class="link" href="#removeresponseheader-gatewayfilter-factory">5.15. RemoveResponseHeader GatewayFilter Factory</a></h3>
|
||||
<h3 id="removeresponseheader-gatewayfilter-factory"><a class="anchor" href="#removeresponseheader-gatewayfilter-factory"></a><a class="link" href="#removeresponseheader-gatewayfilter-factory">5.14. RemoveResponseHeader GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RemoveResponseHeader GatewayFilter Factory takes a <code>name</code> parameter. It is the name of the header to be removed.</p>
|
||||
</div>
|
||||
@@ -1432,7 +1301,7 @@ and have it applied to all routes.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="removerequestparameter-gatewayfilter-factory"><a class="anchor" href="#removerequestparameter-gatewayfilter-factory"></a><a class="link" href="#removerequestparameter-gatewayfilter-factory">5.16. RemoveRequestParameter GatewayFilter Factory</a></h3>
|
||||
<h3 id="removerequestparameter-gatewayfilter-factory"><a class="anchor" href="#removerequestparameter-gatewayfilter-factory"></a><a class="link" href="#removerequestparameter-gatewayfilter-factory">5.15. RemoveRequestParameter GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RemoveRequestParameter GatewayFilter Factory takes a <code>name</code> parameter. It is the name of the query parameter to be removed.</p>
|
||||
</div>
|
||||
@@ -1454,7 +1323,7 @@ and have it applied to all routes.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="rewritepath-gatewayfilter-factory"><a class="anchor" href="#rewritepath-gatewayfilter-factory"></a><a class="link" href="#rewritepath-gatewayfilter-factory">5.17. RewritePath GatewayFilter Factory</a></h3>
|
||||
<h3 id="rewritepath-gatewayfilter-factory"><a class="anchor" href="#rewritepath-gatewayfilter-factory"></a><a class="link" href="#rewritepath-gatewayfilter-factory">5.16. RewritePath GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RewritePath GatewayFilter Factory takes a path <code>regexp</code> parameter and a <code>replacement</code> parameter. This uses Java regular expressions for a flexible way to rewrite the request path.</p>
|
||||
</div>
|
||||
@@ -1478,7 +1347,7 @@ and have it applied to all routes.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="rewritelocationresponseheader-gatewayfilter-factory"><a class="anchor" href="#rewritelocationresponseheader-gatewayfilter-factory"></a><a class="link" href="#rewritelocationresponseheader-gatewayfilter-factory">5.18. RewriteLocationResponseHeader GatewayFilter Factory</a></h3>
|
||||
<h3 id="rewritelocationresponseheader-gatewayfilter-factory"><a class="anchor" href="#rewritelocationresponseheader-gatewayfilter-factory"></a><a class="link" href="#rewritelocationresponseheader-gatewayfilter-factory">5.17. RewriteLocationResponseHeader GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RewriteLocationResponseHeader GatewayFilter Factory modifies the value of <code>Location</code> response header, usually to get rid of backend specific details. It takes <code>stripVersionMode</code>, <code>locationHeaderName</code>, <code>hostValue</code>, and <code>protocolsRegex</code> parameters.</p>
|
||||
</div>
|
||||
@@ -1522,7 +1391,7 @@ and have it applied to all routes.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="rewriteresponseheader-gatewayfilter-factory"><a class="anchor" href="#rewriteresponseheader-gatewayfilter-factory"></a><a class="link" href="#rewriteresponseheader-gatewayfilter-factory">5.19. RewriteResponseHeader GatewayFilter Factory</a></h3>
|
||||
<h3 id="rewriteresponseheader-gatewayfilter-factory"><a class="anchor" href="#rewriteresponseheader-gatewayfilter-factory"></a><a class="link" href="#rewriteresponseheader-gatewayfilter-factory">5.18. RewriteResponseHeader GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RewriteResponseHeader GatewayFilter Factory takes <code>name</code>, <code>regexp</code>, and <code>replacement</code> parameters. It uses Java regular expressions for a flexible way to rewrite the response header value.</p>
|
||||
</div>
|
||||
@@ -1544,7 +1413,7 @@ and have it applied to all routes.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="savesession-gatewayfilter-factory"><a class="anchor" href="#savesession-gatewayfilter-factory"></a><a class="link" href="#savesession-gatewayfilter-factory">5.20. SaveSession GatewayFilter Factory</a></h3>
|
||||
<h3 id="savesession-gatewayfilter-factory"><a class="anchor" href="#savesession-gatewayfilter-factory"></a><a class="link" href="#savesession-gatewayfilter-factory">5.19. SaveSession GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The SaveSession GatewayFilter Factory forces a <code>WebSession::save</code> operation <em>before</em> forwarding the call downstream. This is of particular use when
|
||||
using something like <a href="https://projects.spring.io/spring-session/">Spring Session</a> with a lazy data store and need to ensure the session state has been saved before making the forwarded call.</p>
|
||||
@@ -1569,7 +1438,7 @@ using something like <a href="https://projects.spring.io/spring-session/">Spring
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="secureheaders-gatewayfilter-factory"><a class="anchor" href="#secureheaders-gatewayfilter-factory"></a><a class="link" href="#secureheaders-gatewayfilter-factory">5.21. SecureHeaders GatewayFilter Factory</a></h3>
|
||||
<h3 id="secureheaders-gatewayfilter-factory"><a class="anchor" href="#secureheaders-gatewayfilter-factory"></a><a class="link" href="#secureheaders-gatewayfilter-factory">5.20. SecureHeaders GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The SecureHeaders GatewayFilter Factory adds a number of headers to the response at the recommendation from <a href="https://blog.appcanary.com/2017/http-security-headers.html">this blog post</a>.</p>
|
||||
</div>
|
||||
@@ -1643,7 +1512,7 @@ using something like <a href="https://projects.spring.io/spring-session/">Spring
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="setpath-gatewayfilter-factory"><a class="anchor" href="#setpath-gatewayfilter-factory"></a><a class="link" href="#setpath-gatewayfilter-factory">5.22. SetPath GatewayFilter Factory</a></h3>
|
||||
<h3 id="setpath-gatewayfilter-factory"><a class="anchor" href="#setpath-gatewayfilter-factory"></a><a class="link" href="#setpath-gatewayfilter-factory">5.21. SetPath GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The SetPath GatewayFilter Factory takes a path <code>template</code> parameter. It offers a simple way to manipulate the request path by allowing templated segments of the path. This uses the uri templates from Spring Framework. Multiple matching segments are allowed.</p>
|
||||
</div>
|
||||
@@ -1667,7 +1536,7 @@ using something like <a href="https://projects.spring.io/spring-session/">Spring
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="setrequestheader-gatewayfilter-factory"><a class="anchor" href="#setrequestheader-gatewayfilter-factory"></a><a class="link" href="#setrequestheader-gatewayfilter-factory">5.23. SetRequestHeader GatewayFilter Factory</a></h3>
|
||||
<h3 id="setrequestheader-gatewayfilter-factory"><a class="anchor" href="#setrequestheader-gatewayfilter-factory"></a><a class="link" href="#setrequestheader-gatewayfilter-factory">5.22. SetRequestHeader GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The SetRequestHeader GatewayFilter Factory takes <code>name</code> and <code>value</code> parameters.</p>
|
||||
</div>
|
||||
@@ -1707,7 +1576,7 @@ using something like <a href="https://projects.spring.io/spring-session/">Spring
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="setresponseheader-gatewayfilter-factory"><a class="anchor" href="#setresponseheader-gatewayfilter-factory"></a><a class="link" href="#setresponseheader-gatewayfilter-factory">5.24. SetResponseHeader GatewayFilter Factory</a></h3>
|
||||
<h3 id="setresponseheader-gatewayfilter-factory"><a class="anchor" href="#setresponseheader-gatewayfilter-factory"></a><a class="link" href="#setresponseheader-gatewayfilter-factory">5.23. SetResponseHeader GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The SetResponseHeader GatewayFilter Factory takes <code>name</code> and <code>value</code> parameters.</p>
|
||||
</div>
|
||||
@@ -1747,7 +1616,7 @@ using something like <a href="https://projects.spring.io/spring-session/">Spring
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="setstatus-gatewayfilter-factory"><a class="anchor" href="#setstatus-gatewayfilter-factory"></a><a class="link" href="#setstatus-gatewayfilter-factory">5.25. SetStatus GatewayFilter Factory</a></h3>
|
||||
<h3 id="setstatus-gatewayfilter-factory"><a class="anchor" href="#setstatus-gatewayfilter-factory"></a><a class="link" href="#setstatus-gatewayfilter-factory">5.24. SetStatus GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The SetStatus GatewayFilter Factory takes a single <code>status</code> parameter. It must be a valid Spring <code>HttpStatus</code>. It may be the integer value <code>404</code> or the string representation of the enumeration <code>NOT_FOUND</code>.</p>
|
||||
</div>
|
||||
@@ -1786,7 +1655,7 @@ using something like <a href="https://projects.spring.io/spring-session/">Spring
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="stripprefix-gatewayfilter-factory"><a class="anchor" href="#stripprefix-gatewayfilter-factory"></a><a class="link" href="#stripprefix-gatewayfilter-factory">5.26. StripPrefix GatewayFilter Factory</a></h3>
|
||||
<h3 id="stripprefix-gatewayfilter-factory"><a class="anchor" href="#stripprefix-gatewayfilter-factory"></a><a class="link" href="#stripprefix-gatewayfilter-factory">5.25. StripPrefix GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The StripPrefix GatewayFilter Factory takes one parameter, <code>parts</code>. The <code>parts</code> parameter indicated the number of parts in the path to strip from the request before sending it downstream.</p>
|
||||
</div>
|
||||
@@ -1810,7 +1679,7 @@ using something like <a href="https://projects.spring.io/spring-session/">Spring
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="retry-gatewayfilter-factory"><a class="anchor" href="#retry-gatewayfilter-factory"></a><a class="link" href="#retry-gatewayfilter-factory">5.27. Retry GatewayFilter Factory</a></h3>
|
||||
<h3 id="retry-gatewayfilter-factory"><a class="anchor" href="#retry-gatewayfilter-factory"></a><a class="link" href="#retry-gatewayfilter-factory">5.26. Retry GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The Retry GatewayFilter Factory support following set of parameters:</p>
|
||||
</div>
|
||||
@@ -1909,7 +1778,7 @@ When using the retry filter with a <code>forward:</code> prefixed URL, the targe
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="requestsize-gatewayfilter-factory"><a class="anchor" href="#requestsize-gatewayfilter-factory"></a><a class="link" href="#requestsize-gatewayfilter-factory">5.28. RequestSize GatewayFilter Factory</a></h3>
|
||||
<h3 id="requestsize-gatewayfilter-factory"><a class="anchor" href="#requestsize-gatewayfilter-factory"></a><a class="link" href="#requestsize-gatewayfilter-factory">5.27. RequestSize GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The RequestSize GatewayFilter Factory can restrict a request from reaching the downstream service , when the request size is greater than the permissible limit. The filter takes <code>RequestSize</code> as parameter which is the permissible size limit of the request defined in bytes.</p>
|
||||
</div>
|
||||
@@ -1950,7 +1819,7 @@ The default Request size will be set to 5 MB if not provided as filter argument
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="modify-request-body-gatewayfilter-factory"><a class="anchor" href="#modify-request-body-gatewayfilter-factory"></a><a class="link" href="#modify-request-body-gatewayfilter-factory">5.29. Modify Request Body GatewayFilter Factory</a></h3>
|
||||
<h3 id="modify-request-body-gatewayfilter-factory"><a class="anchor" href="#modify-request-body-gatewayfilter-factory"></a><a class="link" href="#modify-request-body-gatewayfilter-factory">5.28. Modify Request Body GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p><strong>This filter is considered BETA and the API may change in the future</strong></p>
|
||||
</div>
|
||||
@@ -2002,7 +1871,7 @@ static class Hello {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="modify-response-body-gatewayfilter-factory"><a class="anchor" href="#modify-response-body-gatewayfilter-factory"></a><a class="link" href="#modify-response-body-gatewayfilter-factory">5.30. Modify Response Body GatewayFilter Factory</a></h3>
|
||||
<h3 id="modify-response-body-gatewayfilter-factory"><a class="anchor" href="#modify-response-body-gatewayfilter-factory"></a><a class="link" href="#modify-response-body-gatewayfilter-factory">5.29. Modify Response Body GatewayFilter Factory</a></h3>
|
||||
<div class="paragraph">
|
||||
<p><strong>This filter is considered BETA and the API may change in the future</strong></p>
|
||||
</div>
|
||||
@@ -2036,7 +1905,7 @@ public RouteLocator routes(RouteLocatorBuilder builder) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="default-filters"><a class="anchor" href="#default-filters"></a><a class="link" href="#default-filters">5.31. Default Filters</a></h3>
|
||||
<h3 id="default-filters"><a class="anchor" href="#default-filters"></a><a class="link" href="#default-filters">5.30. Default Filters</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>If you would like to add a filter and apply it to all routes you can use <code>spring.cloud.gateway.default-filters</code>.
|
||||
This property takes a list of filters</p>
|
||||
|
||||
Reference in New Issue
Block a user