欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 能源 > gateway 网关 路由新增 (已亲测)

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

2025/6/6 11:55:19 来源:https://blog.csdn.net/qq_33930506/article/details/148431422  浏览:    关键词: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

操作截图:

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词