【发布时间】:2019-08-13 18:54:11
【问题描述】:
我有以下 Nginx 配置:
server {
listen 8080 default_server;
listen [::]:8080 default_server;
...
error_page 401 = @login;
location @login {
return 302 https://$http_host/logon?continueURL=https://$http_host;
}
location /logon {
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://${UPSTREAM_URL}$request_uri;
}
...
}
在 Docker 文件中配置的 UPSTREAM_URL。
问题是当我有 401 错误时,Nginx 重定向到 https://localhost:8080/logon?continueURL=https://localhost:8080 而不是 http://${UPSTREAM_URL}$request_uri
Docker 镜像是nginx:alpine
我应该对我的配置进行哪些更改?
【问题讨论】:
标签: nginx