diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index aad39e93..86d1b8f3 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -41,16 +41,16 @@ |spring.cloud.gateway.filter.rewrite-path.enabled | `true` | Enables the rewrite-path filter. |spring.cloud.gateway.filter.rewrite-response-header.enabled | `true` | Enables the rewrite-response-header filter. |spring.cloud.gateway.filter.save-session.enabled | `true` | Enables the save-session filter. -|spring.cloud.gateway.filter.secure-headers.content-security-policy | `default-src 'self' https:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'; script-src https:; style-src 'self' https: 'unsafe-inline'` | -|spring.cloud.gateway.filter.secure-headers.content-type-options | `nosniff` | +|spring.cloud.gateway.filter.secure-headers.content-security-policy | `default-src 'self' https:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'; script-src https:; style-src 'self' https: 'unsafe-inline'` | +|spring.cloud.gateway.filter.secure-headers.content-type-options | `nosniff` | |spring.cloud.gateway.filter.secure-headers.disable | | -|spring.cloud.gateway.filter.secure-headers.download-options | `noopen` | +|spring.cloud.gateway.filter.secure-headers.download-options | `noopen` | |spring.cloud.gateway.filter.secure-headers.enabled | `true` | Enables the secure-headers filter. -|spring.cloud.gateway.filter.secure-headers.frame-options | `DENY` | -|spring.cloud.gateway.filter.secure-headers.permitted-cross-domain-policies | `none` | -|spring.cloud.gateway.filter.secure-headers.referrer-policy | `no-referrer` | -|spring.cloud.gateway.filter.secure-headers.strict-transport-security | `max-age=631138519` | -|spring.cloud.gateway.filter.secure-headers.xss-protection-header | `1 ; mode=block` | +|spring.cloud.gateway.filter.secure-headers.frame-options | `DENY` | +|spring.cloud.gateway.filter.secure-headers.permitted-cross-domain-policies | `none` | +|spring.cloud.gateway.filter.secure-headers.referrer-policy | `no-referrer` | +|spring.cloud.gateway.filter.secure-headers.strict-transport-security | `max-age=631138519` | +|spring.cloud.gateway.filter.secure-headers.xss-protection-header | `1 ; mode=block` | |spring.cloud.gateway.filter.set-path.enabled | `true` | Enables the set-path filter. |spring.cloud.gateway.filter.set-request-header.enabled | `true` | Enables the set-request-header filter. |spring.cloud.gateway.filter.set-request-host-header.enabled | `true` | Enables the set-request-host-header filter. @@ -103,7 +103,7 @@ |spring.cloud.gateway.httpclient.websocket.proxy-ping | `true` | Proxy ping frames to downstream services, defaults to true. |spring.cloud.gateway.httpclient.wiretap | `false` | Enables wiretap debugging for Netty HttpClient. |spring.cloud.gateway.httpserver.wiretap | `false` | Enables wiretap debugging for Netty HttpServer. -|spring.cloud.gateway.loadbalancer.use404 | `false` | +|spring.cloud.gateway.loadbalancer.use404 | `false` | |spring.cloud.gateway.metrics.enabled | `false` | Enables the collection of metrics data. |spring.cloud.gateway.metrics.prefix | `spring.cloud.gateway` | The prefix of all metrics emitted by gateway. |spring.cloud.gateway.metrics.tags | | Tags map that added to metrics. diff --git a/docs/src/main/asciidoc/spring-cloud-gateway.adoc b/docs/src/main/asciidoc/spring-cloud-gateway.adoc index a8a3cfe5..4f227772 100644 --- a/docs/src/main/asciidoc/spring-cloud-gateway.adoc +++ b/docs/src/main/asciidoc/spring-cloud-gateway.adoc @@ -1766,45 +1766,6 @@ If the URL has a `forward` scheme (such as `forward:///localendpoint`), it uses The path part of the request URL is overridden with the path in the forward URL. The unmodified original URL is appended to the list in the `ServerWebExchangeUtils.GATEWAY_ORIGINAL_REQUEST_URL_ATTR` attribute. -=== The `LoadBalancerClient` Filter - -The `LoadBalancerClientFilter` looks for a URI in the exchange attribute named `ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR`. -If the URL has a scheme of `lb` (such as `lb://myservice`), it uses the Spring Cloud `LoadBalancerClient` to resolve the name (`myservice` in this case) to an actual host and port and replaces the URI in the same attribute. -The unmodified original URL is appended to the list in the `ServerWebExchangeUtils.GATEWAY_ORIGINAL_REQUEST_URL_ATTR` attribute. -The filter also looks in the `ServerWebExchangeUtils.GATEWAY_SCHEME_PREFIX_ATTR` attribute to see if it equals `lb`. -If so, the same rules apply. -The following listing configures a `LoadBalancerClientFilter`: - -.application.yml -==== -[source,yaml] ----- -spring: - cloud: - gateway: - routes: - - id: myRoute - uri: lb://service - predicates: - - Path=/service/** ----- -==== - -NOTE: By default, when a service instance cannot be found in the `LoadBalancer`, a `503` is returned. -You can configure the Gateway to return a `404` by setting `spring.cloud.gateway.loadbalancer.use404=true`. - -NOTE: The `isSecure` value of the `ServiceInstance` returned from the `LoadBalancer` overrides -the scheme specified in the request made to the Gateway. -For example, if the request comes into the Gateway over `HTTPS` -but the `ServiceInstance` indicates it is not secure, the downstream request is made over -`HTTP`. -The opposite situation can also apply. -However, if `GATEWAY_SCHEME_PREFIX_ATTR` is specified for the -route in the Gateway configuration, the prefix is stripped and the resulting scheme from the -route URL overrides the `ServiceInstance` configuration. - -TIP: Gateway supports all the LoadBalancer features. You can read more about them in the https://docs.spring.io/spring-cloud-commons/docs/current/reference/html/#spring-cloud-loadbalancer[Spring Cloud Commons documentation]. - [[reactive-loadbalancer-client-filter]] === The `ReactiveLoadBalancerClientFilter` @@ -1839,6 +1800,8 @@ For example, if the request comes into the Gateway over `HTTPS` but the `Service The opposite situation can also apply. However, if `GATEWAY_SCHEME_PREFIX_ATTR` is specified for the route in the Gateway configuration, the prefix is stripped and the resulting scheme from the route URL overrides the `ServiceInstance` configuration. +TIP: Gateway supports all the LoadBalancer features. You can read more about them in the https://docs.spring.io/spring-cloud-commons/docs/current/reference/html/#spring-cloud-loadbalancer[Spring Cloud Commons documentation]. + === The Netty Routing Filter The Netty routing filter runs if the URL located in the `ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR` exchange attribute has a `http` or `https` scheme. @@ -2370,7 +2333,7 @@ To retrieve the <> applied to all routes, make a ==== ---- { - "org.springframework.cloud.gateway.filter.LoadBalancerClientFilter@77856cc5": 10100, + "org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@77856cc5": 10100, "org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@4f6fd101": 10000, "org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@32d22650": -1, "org.springframework.cloud.gateway.filter.ForwardRoutingFilter@106459d9": 2147483647, @@ -2383,7 +2346,7 @@ To retrieve the <> applied to all routes, make a ==== The response contains the details of the global filters that are in place. -For each global filter, there is a string representation of the filter object (for example, `org.springframework.cloud.gateway.filter.LoadBalancerClientFilter@77856cc5`) and the corresponding <> in the filter chain.} +For each global filter, there is a string representation of the filter object (for example, `org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@77856cc5`) and the corresponding <> in the filter chain.} [[gateway-route-filters]] ==== Route Filters