Skip to content

Latest commit

 

History

History
45 lines (37 loc) · 1.2 KB

File metadata and controls

45 lines (37 loc) · 1.2 KB

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.