This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Cloud Gateway 4.2.0!

RewriteRequestParameter GatewayFilter Factory

The RewriteRequestParameter GatewayFilter factory takes a name parameter and a replacement parameter. It will rewrite the value of the request parameter of the given name. If multiple request parameters with the same name are set, they will be replaced with a single value. If no request parameter is found, no changes will be made. The following listing configures a RewriteRequestParameter GatewayFilter:

Example 1. application.yml
spring:
  cloud:
    gateway:
      routes:
      - id: rewriterequestparameter_route
        uri: https://example.org
        predicates:
        - Path=/products
        filters:
        - RewriteRequestParameter=campaign,fall2023

For a request to /products?campaign=old, this sets the request parameter to campaign=fall2023.