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!

RemoveRequestParameter Filter

The RemoveRequestParameter filter takes a name parameter. It is the name of the query parameter to be removed. The following example configures a RemoveRequestParameter filter:

application.yml
spring:
  cloud:
    gateway:
      mvc:
        routes:
        - id: removerequestparameter_route
          uri: https://example.org
          filters:
          - RemoveRequestParameter=red
GatewaySampleApplication.java
import static org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.addRequestParameter;
import static org.springframework.cloud.gateway.server.mvc.handler.GatewayRouterFunctions.route;
import static org.springframework.cloud.gateway.server.mvc.handler.HandlerFunctions.http;

@Configuration
class RouteConfiguration {

    @Bean
    public RouterFunction<ServerResponse> gatewayRouterFunctionsAddReqHeader() {
		return route("removerequestparameter_route")
				.GET("/**", http("https://example.org"))
					.before(removeRequestParameter("red"))
					.build();
    }
}

This will remove the red parameter before it is sent downstream.