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

操作截图:

相关推荐
无名客04 天前
SpringCloud中的网关(Gateway)的作用是什么?
spring·spring cloud·gateway
smilecold5 天前
SpringCloud 入门 - Gateway 网关与 OpenFeign 服务调用
spring cloud·gateway
INFINI Labs7 天前
Elasticsearch 备份:方案篇
大数据·elasticsearch·搜索引擎·gateway·snapshot·backup·ccr
纤瘦的鲸鱼7 天前
Spring Gateway 全面解析:从入门到进阶实践
java·spring·gateway
INFINI Labs10 天前
如何使用 INFINI Gateway 对比 ES 索引数据
大数据·elasticsearch·gateway·easysearch
m0_6515939111 天前
位置透明性、Spring Cloud Gateway与reactor响应式编程的关系
java·spring cloud·系统架构·gateway
nvd1112 天前
使用gateway api来实现GKE 的pods 从外部访问
gateway·googlecloud
罗不俷12 天前
【Kubernetes】(二十)Gateway
容器·kubernetes·gateway
月夕·花晨14 天前
Gateway-过滤器
java·分布式·spring·spring cloud·微服务·gateway·sentinel
Ytadpole15 天前
性能革命的底层逻辑:深入理解 Spring Cloud Gateway 的 Reactor 核心
java·spring·gateway·reactor·响应式编程·cloud