【发布时间】:2020-10-06 18:06:00
【问题描述】:
我在使用 nginx 时遇到了重定向问题,我真的不知道该怎么做。
问题是我需要将所有流量重定向到一个网站包括路径
BASE_URL:https://example.com/auth/
例如,如果请求是:https://example.com/auth/some/path/
我需要它重定向到:https://newdomain.com/some/path/
也就是说,我需要将/some/path/的部分连接到新的URL。
这是我尝试过的部分代码
location /auth/* {
proxy_pass https://newdomain.com/$request_uri;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
谢谢。
【问题讨论】:
标签: nginx redirect nginx-reverse-proxy