diff --git a/spring-cloud-gateway.html b/spring-cloud-gateway.html index 35373941..3722fcb6 100644 --- a/spring-cloud-gateway.html +++ b/spring-cloud-gateway.html @@ -131,6 +131,7 @@ $(addBlockSwitches);
  • RemoveResponseHeader GatewayFilter Factory
  • RemoveRequestParameter GatewayFilter Factory
  • RewritePath GatewayFilter Factory
  • +
  • RewriteLocationResponseHeader GatewayFilter Factory
  • RewriteResponseHeader GatewayFilter Factory
  • SaveSession GatewayFilter Factory
  • SecureHeaders GatewayFilter Factory
  • @@ -1308,6 +1309,50 @@ and have it applied to all routes.

    +

    RewriteLocationResponseHeader GatewayFilter Factory

    +
    +

    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:
    +    gateway:
    +      routes:
    +      - id: rewritelocationresponseheader_route
    +        uri: http://example.org
    +        filters:
    +        - RewriteLocationResponseHeader=AS_IN_REQUEST, Location, ,
    +
    +
    +
    +

    For example, for a request POST https://api.example.com/some/object/name, Location response header value https://object-service.prod.example.net/v2/some/object/id will be rewritten as https://api.example.com/some/object/id.

    +
    +
    +

    Parameter stripVersionMode has the following possible values: NEVER_STRIP, AS_IN_REQUEST (default), ALWAYS_STRIP.

    +
    +
    + +
    +
    +

    Parameter hostValue, if provided, will be used to replace the host:port portion of the response Location header. If not provided, the value of the Host request header will be used.

    +
    +
    +

    Parameter protocolsRegex must be a valid regex String, against which the protocol name will be matched. If not matched, the filter will do nothing. Default is http|https|ftp|ftps.

    +
    +
    +

    RewriteResponseHeader GatewayFilter Factory

    The RewriteResponseHeader GatewayFilter Factory takes name, regexp, and replacement parameters. It uses Java regular expressions for a flexible way to rewrite the response header value.