gateway 网关 路由新增 (已亲测)

问题:

前端通过gateway调用后端接口,路由转发失败,提示404 not found

排查:

使用 { "href":"/actuator/gateway/routes", "methods":[ "POST", "GET" ] } 命令查看路由列表,确实缺少路由信息

curl -v http://127.0.0.1:9090/actuator/gateway/routes >> 123.txt

输出到 123.txt 文件

处理方式:

1、 手动刷新

{ "href":"/actuator/gateway/refresh", "methods":[ "POST" ] }

2、 手动添加

{ "href":"/actuator/gateway/routes/route-id-1", "methods":[ "POST", "DELETE", "GET" ] }

官方说明:

To create a route definition, make a POST request to /gateway/routes/{id_route_to_create} with a JSON body that specifies the fields of the route (see Retrieving Information about a Particular Route).

To delete a route definition, make a DELETE request to /gateway/routes/{id_route_to_delete}.

官网地址:
Spring Cloud Gateway

操作截图:

相关推荐
曼彻斯特的海边15 小时前
RequestRateLimiterGatewayFilterFactory
spring cloud·gateway·限流
·云扬·15 小时前
【PmHub面试篇】Gateway全局过滤器统计接口调用耗时面试要点解析
面试·职场和发展·gateway
wmd1316430671215 小时前
Gateway 搭建
gateway
KubeSphere 云原生3 天前
云原生周刊:探索 Gateway API v1.3.0
云原生·gateway
曼彻斯特的海边4 天前
spring-cloud-alibaba-sentinel-gateway
gateway·sentinel·springcloud
xujinwei_gingko5 天前
网关Gateway
微服务·gateway
徐子童6 天前
《Spring Cloud Gateway 快速入门:从路由到自定义 Filter 的完整教程》
java·开发语言·spring cloud·nacos·gateway
亚林瓜子6 天前
AWS API Gateway 配置WAF(中国区)
云计算·gateway·aws·waf
枫super10 天前
Spring Cloud 详解:2025 最新技术与最佳实践
后端·spring·spring cloud·eureka·nacos·gateway·openfeign