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

操作截图:

相关推荐
yuluo_YX12 天前
AI Gateway 介绍
人工智能·gateway
网硕互联的小客服15 天前
502 Bad Gateway:服务器作为网关或代理时收到无效响应处理方式
运维·服务器·gateway
sevevty-seven15 天前
什么是Gateway
gateway
秋の花15 天前
【GateWay】和权限验证
java·gateway
欧先生^_^17 天前
org.springframework.cloud.gateway 组件解释
gateway
jarenyVO18 天前
Spring Cloud Gateway 全面学习指南
java·gateway
保持学习ing20 天前
微服务--Gateway网关
java·网关·微服务·gateway
SZ17011023121 天前
IGP(Interior Gateway Protocol,内部网关协议)
运维·服务器·gateway
肥仔哥哥193021 天前
SpringCloud2025+SpringBoot3.5.0+gateway+webflux子服务路由报503
微服务·gateway·最新微服务
亚林瓜子1 个月前
AWS API Gateway配置日志
云计算·gateway·aws·log·cloudwatch