@Order(1000)
public class HeaderFilter implements GlobalFilter{
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
Object routeValue = exchange.getAttribute("route");
ServerHttpRequest request = exchange.getRequest().mutate().header(route, (String) routeValue).build();
return chain.filter(exchange.mutate().request(request).build());
}
}
ServerWebExchange header设置
最新推荐文章于 2024-09-14 20:52:59 发布