Adds missing yaml config and fixes missing mvc key.
Fixes gh-3174
This commit is contained in:
@@ -4,6 +4,20 @@
|
||||
The `AddRequestHeader` is a "before" filter that takes a `name` and `value` parameter.
|
||||
The following example configures an `AddRequestHeader` filter:
|
||||
|
||||
.application.yml
|
||||
[source,yaml]
|
||||
----
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
mvc:
|
||||
routes:
|
||||
- id: add_request_header_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- AddRequestHeader=X-Request-red, blue
|
||||
----
|
||||
|
||||
.GatewaySampleApplication.java
|
||||
[source,java]
|
||||
----
|
||||
|
||||
@@ -4,6 +4,20 @@
|
||||
The `AddRequestHeadersIfNotPresent` filter takes a collection of `name` and `value` pairs separated by colon.
|
||||
The following example configures an `AddRequestHeadersIfNotPresent` filter:
|
||||
|
||||
.application.yml
|
||||
[source,yaml]
|
||||
----
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
mvc:
|
||||
routes:
|
||||
- id: add_request_headers_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- AddRequestHeadersIfNotPresent=X-Request-Color-1:blue,X-Request-Color-2:green
|
||||
----
|
||||
|
||||
.GatewaySampleApplication.java
|
||||
[source,java]
|
||||
----
|
||||
|
||||
@@ -4,6 +4,20 @@
|
||||
The `AddRequestParameter` Filter takes a `name` and `value` parameter.
|
||||
The following example configures an `AddRequestParameter` filter:
|
||||
|
||||
application.yml
|
||||
[source,yaml]
|
||||
----
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
mvc:
|
||||
routes:
|
||||
- id: add_request_parameter_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- AddRequestParameter=red, blue
|
||||
----
|
||||
|
||||
.GatewaySampleApplication.java
|
||||
[source,java]
|
||||
----
|
||||
|
||||
@@ -4,6 +4,20 @@
|
||||
The `AddResponseHeader` Filter takes a `name` and `value` parameter.
|
||||
The following example configures an `AddResponseHeader` filter:
|
||||
|
||||
.application.yml
|
||||
[source,yaml]
|
||||
----
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
mvc:
|
||||
routes:
|
||||
- id: add_response_header_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- AddResponseHeader=X-Response-Red, Blue
|
||||
----
|
||||
|
||||
.GatewaySampleApplication.java
|
||||
[source,java]
|
||||
----
|
||||
|
||||
@@ -13,11 +13,12 @@ The following example configures a Spring Cloud CircuitBreaker filter:
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
- id: circuitbreaker_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- CircuitBreaker=myCircuitBreaker
|
||||
mvc:
|
||||
routes:
|
||||
- id: circuitbreaker_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- CircuitBreaker=myCircuitBreaker
|
||||
----
|
||||
.GatewaySampleApplication.java
|
||||
[source,java]
|
||||
@@ -54,16 +55,17 @@ The following example configures such a fallback:
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
- id: circuitbreaker_route
|
||||
uri: https://example.org
|
||||
predicates:
|
||||
- Path=/consumingServiceEndpoint
|
||||
filters:
|
||||
- name: CircuitBreaker
|
||||
args:
|
||||
name: myCircuitBreaker
|
||||
fallbackUri: forward:/inCaseOfFailureUseThis
|
||||
mvc:
|
||||
routes:
|
||||
- id: circuitbreaker_route
|
||||
uri: https://example.org
|
||||
predicates:
|
||||
- Path=/consumingServiceEndpoint
|
||||
filters:
|
||||
- name: CircuitBreaker
|
||||
args:
|
||||
name: myCircuitBreaker
|
||||
fallbackUri: forward:/inCaseOfFailureUseThis
|
||||
----
|
||||
|
||||
The following listing does the same thing in Java:
|
||||
@@ -170,19 +172,20 @@ value or the String representation of the `HttpStatus` enumeration.
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
- id: circuitbreaker_route
|
||||
uri: lb://backing-service:8088
|
||||
predicates:
|
||||
- Path=/consumingServiceEndpoint
|
||||
filters:
|
||||
- name: CircuitBreaker
|
||||
args:
|
||||
name: myCircuitBreaker
|
||||
fallbackUri: forward:/inCaseOfFailureUseThis
|
||||
statusCodes:
|
||||
- 500
|
||||
- "NOT_FOUND"
|
||||
mvc:
|
||||
routes:
|
||||
- id: circuitbreaker_route
|
||||
uri: lb://backing-service:8088
|
||||
predicates:
|
||||
- Path=/consumingServiceEndpoint
|
||||
filters:
|
||||
- name: CircuitBreaker
|
||||
args:
|
||||
name: myCircuitBreaker
|
||||
fallbackUri: forward:/inCaseOfFailureUseThis
|
||||
statusCodes:
|
||||
- 500
|
||||
- "NOT_FOUND"
|
||||
----
|
||||
|
||||
.GatewaySampleApplication.java
|
||||
|
||||
@@ -10,11 +10,12 @@ The following example configures a `DedupeResponseHeader` filter:
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
- id: dedupe_response_header_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
|
||||
mvc:
|
||||
routes:
|
||||
- id: dedupe_response_header_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
|
||||
----
|
||||
.GatewaySampleApplication.java
|
||||
[source,java]
|
||||
|
||||
@@ -9,24 +9,25 @@ The `FallbackHeaders` factory lets you add Spring Cloud CircuitBreaker execution
|
||||
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
|
||||
filters:
|
||||
- name: FallbackHeaders
|
||||
args:
|
||||
executionExceptionTypeHeaderName: Test-Header
|
||||
mvc:
|
||||
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
|
||||
filters:
|
||||
- name: FallbackHeaders
|
||||
args:
|
||||
executionExceptionTypeHeaderName: Test-Header
|
||||
----
|
||||
|
||||
.GatewaySampleApplication.java
|
||||
|
||||
@@ -7,6 +7,20 @@ If the input header does not exist, the filter has no impact.
|
||||
If the new named header already exists, its values are augmented with the new values.
|
||||
The following example configures a `MapRequestHeader`:
|
||||
|
||||
.application.yml
|
||||
[source,yaml]
|
||||
----
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
mvc:
|
||||
routes:
|
||||
- id: map_request_header_route
|
||||
uri: https://example.org
|
||||
filters:
|
||||
- MapRequestHeader=Blue, X-Request-Red
|
||||
----
|
||||
|
||||
.GatewaySampleApplication.java
|
||||
[source,java]
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user