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

操作截图:

相关推荐
云和数据.ChenGuang13 小时前
`neutron router-gateway-set` 操作失败的可能原因及解决方案
运维·gateway·运维技术总结·运维技术
要开心吖ZSH2 天前
【Spring Cloud Gateway 实战系列】终极篇:演进方向与未来架构
spring cloud·gateway
@小了白了兔3 天前
统一服务入口——Spring Cloud Gateway
java·spring cloud·gateway
要开心吖ZSH3 天前
【Spring Cloud Gateway 实战系列】进阶篇:过滤器高级用法、动态路由配置与性能优化
spring cloud·性能优化·gateway·负载均衡
亲爱的非洲野猪4 天前
Spring Cloud Gateway 电商系统实战指南:架构设计与深度优化
java·spring cloud·gateway
[听得时光枕水眠]4 天前
Gateway
java·开发语言·gateway
Java小白笔记5 天前
Nacos中feign.FeignException$BadGateway: [502 Bad Gateway]
微服务·gateway
勿芮介8 天前
【微服务】Ocelot微服务网关
微服务·c#·gateway
DexterLien10 天前
API Gateway HTTP API 控制客户端访问 IP 源
http·gateway·aws·lambda·authorizer
johnny23312 天前
ShenYu实战、问题记录
gateway