Spring Data Rest - Proxy path not including link path

两盒软妹~` 提交于 2019-12-22 06:59:15

问题


I'm proxying a Spring REST backend like so:

Backend: http://backend:8080

Proxied localhost:

localhost:3000/api/backend -> http://backend:8080

If I browse locally to a proxied endpoint, it will proxy the request, the links, however, do not include the proxy path, i.e.

GET localhost:3000/api/backend/people

"href": "http://localhost:3000/people"

I would expect this to be:

"href": "http://localhost:3000/api/backend/people"

There any way to fix this?

Thanks!


回答1:


You should have a look at the x-forwarded-*headers your proxy is adding to the request.

If the request from your proxy to the backend contains the header x-forwarded-prefix=/api/backend spring will pick up the prefix and add it to the generated link.

You do not mention which proxy are you using so I cannot tell if your proxy supports adding the x-forwarded-prefix header.



来源:https://stackoverflow.com/questions/36141608/spring-data-rest-proxy-path-not-including-link-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!