From 98d1cda203ca9ad29d7e984f60f3203df81684e8 Mon Sep 17 00:00:00 2001
From: buildmaster
+ - RewritePath=/foo(?<segment>/?.*), $\{segment}
For a request path of /foo/bar, this will set the path to /bar before making the downstream request. Notice the $\ which is replaced with $ because of the YAML spec.
The RewriteLocationResponseHeader GatewayFilter Factory modifies the value of Location response header, usually to get rid of backend specific details. It takes stripVersionMode, locationHeaderName, hostValue, and protocolsRegex parameters.
application.yml.
spring: cloud: diff --git a/2.1.x/single/spring-cloud-gateway.html b/2.1.x/single/spring-cloud-gateway.html index 94670dbb..487ff34b 100644 --- a/2.1.x/single/spring-cloud-gateway.html +++ b/2.1.x/single/spring-cloud-gateway.html @@ -373,7 +373,7 @@ and have it applied to all routes.
+ - RewritePath=/foo(?<segment>/?.*), $\{segment}
For a request path of /foo/bar, this will set the path to /bar before making the downstream request. Notice the $\ which is replaced with $ because of the YAML spec.
The RewriteLocationResponseHeader GatewayFilter Factory modifies the value of Location response header, usually to get rid of backend specific details. It takes stripVersionMode, locationHeaderName, hostValue, and protocolsRegex parameters.
application.yml.
spring: cloud: diff --git a/2.1.x/spring-cloud-gateway.xml b/2.1.x/spring-cloud-gateway.xml index a915331a..f69f6eb2 100644 --- a/2.1.x/spring-cloud-gateway.xml +++ b/2.1.x/spring-cloud-gateway.xml @@ -4,7 +4,7 @@Spring Cloud Gateway -2019-09-15 +2019-09-16 @@ -821,7 +821,7 @@ and have it applied to all routes. predicates: - Path=/foo/** filters: - - RewritePath=/foo/(?<segment>.*), /$\{segment} + - RewritePath=/foo(?<segment>/?.*), $\{segment} For a request path of /foo/bar , this will set the path to/bar before making the downstream request. Notice the$\ which is replaced with$ because of the YAML spec.