🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
```java @Slf4j @Component public class MyGateWayFilter implements GlobalFilter, Ordered { @Override public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { log.info("MyGateWayFilter: " + new Date()); //请求必须携带参数 uname 才允许通过 String uname = exchange.getRequest().getQueryParams().getFirst("uname"); if (uname == null) { log.info("用户名为空,非法用户。"); exchange.getResponse().setStatusCode(HttpStatus.NOT_ACCEPTABLE); return exchange.getResponse().setComplete(); } return chain.filter(exchange); } @Override public int getOrder() { return 0; } } ``` http://localhost:9527/payment/get/uname?uname=zhangsan ``` serverPort:8002,uname=zhangsan ```