谷粒商城19-gulimall-gateway网关使用案例

gulimall-gateway网关使用案例
想要实现针对于“http://localhost:88/hello?url=baidu”,转发到“https://www.baidu.com”,针对于“http://localhost:88/hello?url=qq”的请求,转发到“https://www.qq.com/”

创建“application.yml”

spring:
  cloud:
    gateway:
      routes:
        - id: test_route
          uri: https://www.baidu.com
          predicates:
            - Query=url,baidu
        - id: qq_route
          uri: https://www.qq.com
          predicates:
            - Query=url,qq

启动“gulimall-gateway”进行测试

访问:http://localhost:88/hello?url=baidu

访问:http://localhost:88/hello?url=qq

之所以会显示不存在, 是因为实际访问的是
qq.com/hello

猜你喜欢

转载自blog.csdn.net/qq_33229669/article/details/107736535
今日推荐