From 520f6b19c680c26b133db06cd24059cfa97ee1b6 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Wed, 24 Jul 2019 18:32:22 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- spring-cloud-gateway.html | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) 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.

    +
    +
    +
      +
    • +

      NEVER_STRIP - Version will not be stripped, even if the original request path contains no version

      +
    • +
    • +

      AS_IN_REQUEST - Version will be stripped only if the original request path contains no version

      +
    • +
    • +

      ALWAYS_STRIP - Version will be stripped, even if the original request path contains version

      +
    • +
    +
    +
    +

    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.