我有以下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
我应该如何更改配置?
答案 0 :(得分:0)
`location @login {
return 302 https://$http_host/logon?continueURL=https://$http_host;
}`此行正在重定向