{“msg“:“invalid token“,“code“:401} 问题解决
非法令牌、如果没有登录、没有访问权限、访问就出现检查是否登录检查路由的顺序精确路由放在高优先级、模糊路由放在低优先级spring:cloud:gateway:routes:- id : product_routeuri: lb://gulimall-fastpredicates:- Path=/api/product/**filters:.
·
非法令牌、如果没有登录、没有访问权限、访问就出现
检查是否登录
检查路由的顺序
精确路由高优先级 放在前、
模糊路由低优先级 放在后
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
模糊断言要写在精确断言后
更多推荐
已为社区贡献1条内容
所有评论(0)