我有这个具有auth_request设置的proxy_pass-
location = /auth {
internal;
set $query '';
if ($request_uri ~* "[^\?]+\?(.*)$") {
set $query $1;
}
proxy_pass http://127.0.0.1:8080/login/internal?$query;
}
location = /kibana/ {
proxy_pass http://127.0.0.1:5601;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
auth_request /auth;
}
现在,当身份验证成功时,浏览器将显示kibana应用URI,但是nginx会抛出404错误代码,因为它正在/usr/share/nginx/html
下查找该应用。如果我知道的正确,proxy_pass应该只是将连接发送到代理的URL,但事实并非如此。