Modifying a Location header with nginx proxy_pass

懵懂的女人 提交于 2019-12-01 02:37:31
Chelsea Urquhart

You may be able to use regexp to modify it but a better way is to use a proxy redirect:

proxy_redirect http://foo.bar/baz/ /;

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect

Any Location headers for foo.bar/baz/ will go to /

If you just want to redirect /baz/api, that'll work too.

If any redirects are also adding the port, you'll need to add http://foo.bar:8080/baz/ as well (separate redirect).

Hope this helps!

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