1. spring:
    2. cloud:
    3. gateway:
    4. #设置路由:路由id、路由到微服务的uri、断言
    5. routes:
    6. - id: order_route #路由ID,全局唯一
    7. uri: http://localhost:8020 #目标微服务的请求地址和端口
    8. #配置过滤器工厂
    9. filters:
    10. - AddRequestParameter=color, blue # 添加请求参数

    测试http://localhost:8888/order/testgateway3

    1. @GetMapping("/testgateway3")
    2. public String testGateway3(@RequestParam("color") String color) throws Exception {
    3. log.info("gateWay获取请求参数color:"+color);
    4. return "success";
    5. }

    添加请求参数 - 图1