在这里插入图片描述
非法令牌、如果没有登录、没有访问权限、访问就出现
检查是否登录
检查路由的顺序
精确路由高优先级 放在前、
模糊路由低优先级 放在后

spring:
  cloud:
    gateway:
      routes:
        - id : product_route
          uri: lb://gulimall-fast
          predicates:
            - Path=/api/product/**
          filters:
            - RewritePath=/api/(?<segment>.*),/$\{segment}
## https://localhost:88/api/product/list/tree ---> https://localhost:10000//product/list/tree  找到gulimall-fast服务换端口10000,正则去掉api
        - id : admin_route
          uri: lb://renren-fast
          predicates:
            - Path=/api/**
          filters :
            - RewritePath=/api/(?<segment>.*),/renren-fast/$\{segment}
## https://localhost:88/api/a.jpg ---> https://localhost:8080/renren-fast/a.jpg   找renren-fast服务换端口8080、正则 把api换成renren-fast

模糊断言要写在精确断言后

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐