Gateway 配置参数理解

复制代码
spring:
  cloud:
    gateway:
      routes:
        - id: gateway1
          uri: lb://gateway-test
          predicates:
            - Path=/ershiqijian/**
          filters:
            - StripPrefix=1

id:唯一标识符

这里的

复制代码
predicates:
   - Path=/ershiqijian/**

意味着当例如请求http://ershiqijian/\*\*,也就是请求路径前带上ershiqijian后,gateway会把请求转发到注册到nacos上的gateway-test这个模块

这里的

复制代码
 filters:
    - StripPrefix=1

意味着原先可能需要请求:ershiqijian/server/getall

而现在可以跳过一个前缀,直径请求 ershiqijian/getall 即可

相关推荐
4***W4296 小时前
SpringCloud实战十三:Gateway之 Spring Cloud Gateway 动态路由
java·spring cloud·gateway
3***68849 小时前
SpringCloud Gateway 集成 Sentinel 详解 及实现动态监听Nacos规则配置实时更新流控规则
spring cloud·gateway·sentinel
i***220710 小时前
Gateway Timeout504 网关超时的完美解决方法
gateway
nvd1111 小时前
GKE Gateway超时问题排查指南
gateway
X***C86211 小时前
springcloud-eureka与gateway简易搭建
spring cloud·eureka·gateway
n***s90919 小时前
IP地址、子网掩码(NETMASK)和网关(Gateway)
tcp/ip·gateway·智能路由器
k***19520 小时前
Nginx反向代理出现502 Bad Gateway问题的解决方案
运维·nginx·gateway
7***998720 小时前
Gateway Timeout504 网关超时的完美解决方法
gateway
N***H4861 天前
SpringCloud实战十三:Gateway之 Spring Cloud Gateway 动态路由
java·spring cloud·gateway
0***v7771 天前
SpringCloud Gateway 集成 Sentinel 详解 及实现动态监听Nacos规则配置实时更新流控规则
spring cloud·gateway·sentinel