代码地址

​https://gitee.com/zjj19941/ZJJ_Neaten5.10/tree/master/ZJJ_Gateway/demo07​

测试

#设置路由:路由id、路由到微服务的uri、断言
routes:
- id: order_route #路由ID,全局唯一,建议配合服务名
uri: lb://mall-order
predicates:
- Path=/order2/**
filters:
- RedirectTo=302, http://baidu.com #重定向到百度

测试 :

postman访问:
Gateway重定向操作_gateway

在浏览器输入: ​​http://localhost:8888/order2/findOrderByUserId/1​​​ 敲回车,会自动路由到百度