Gateway路由转发404,是路由配置问题?

新手上路,请多包涵

网关路由后renren-fast的api失效, 如验证码

由前端发送的请求: (http://localhost:88/api/captcha.jpg)

正确的地址应该是: (http://localhost:8001/renren-fast/captcha.jpg)

于是使用路径重写RewritePath filter
- RewritePath=/api/(?<segment>.*),/renren-fast/${segment}

前端发送请求到网关, 网关转发到具体的服务,
但是出现404错误,也就是路径重写跳转失败。单独访问http://localhost:8001/renren-fast/captcha.jpg可以获取验证码的图片。在nacosgateway以及renren-fast已经确认注册上了。这样是哪里出现了问题呢?

下面是仓库地址:
https://gitee.com/Emma_diko/mall

阅读 4.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题