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 即可

相关推荐
sanggou6 小时前
License 集成 Spring Gateway:解决 WebFlux 非阻塞与 Spring MVC Servlet 阻塞兼容问题
spring·gateway·mvc
摘星编程6 天前
Nginx 502 Bad Gateway:从 upstream 日志到 FastCGI 超时复盘
网络·nginx·gateway·php-fpm·fastcgi
网硕互联的小客服6 天前
504 Gateway Timeout:服务器作为网关或代理时未能及时获得响应如何处理?
运维·服务器·gateway
Pierre_7 天前
通过SpringCloud Gateway实现API接口镜像请求(陪跑)网关功能
spring·spring cloud·gateway
kk在加油8 天前
智能门卫:Gateway
gateway
小安同学iter8 天前
Spring Cloud Gateway 网关(五)
java·开发语言·spring cloud·微服务·gateway
JAVA学习通8 天前
Spring Cloud ------ Gateway
java·spring cloud·gateway
weixin_4495687011 天前
访问Nginx 前端页面,接口报502 Bad Gateway
前端·nginx·gateway
yangmf204014 天前
LDAP 认证系列(四):Gateway LDAP 认证
大数据·elasticsearch·搜索引擎·gateway·ldap
银迢迢16 天前
SpringCloud微服务技术自用笔记
java·spring cloud·微服务·gateway·sentinel