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

操作截图:

相关推荐
aFakeProgramer6 天前
S‑CORE someip‑gateway 上手文档
gateway
智码看视界7 天前
Day46—Spring Cloud Gateway:路由/过滤器/限流全攻略
java·gateway·限流·微服务网关·过滤器链
wangjialelele9 天前
Spring Cloud 全体系学习笔记(REST、Nacos、Feign、Gateway)
java·spring boot·笔记·学习·spring·spring cloud·gateway
半支烟隐 pzishuo12 天前
Kubernetes Gateway API 完全指南
容器·kubernetes·gateway
lee_curry12 天前
RuoYi Cloud:Gateway、Auth、System 接入 Prometheus JVM 监控,并练习多副本、滚动升级和故障恢复
jvm·gateway·prometheus
mqiqe12 天前
构建企业级 AI 原生架构:LLM Gateway、RAG、Agent 与 MCP 的协同关系解析
人工智能·架构·gateway
mqiqe13 天前
LLM Gateway:企业级大模型应用的“统一控制平面”
平面·flask·gateway
敲代码的嘎仔13 天前
从零搭建微服务:Spring Cloud Alibaba 全家桶踩坑实录(Nacos + OpenFeign + Gateway + Sentinel)
java·spring boot·spring·spring cloud·微服务·gateway·sentinel