我试图通过代理传递在nginx中执行auth_request,但我一直得到:
1 auth request unexpected status: 301
这是我的配置:
server {
listen 8080;
server_name localhost;
location /my_location/ {
auth_request /access/auth;
try_files $uri =404;
}
location /access/auth/{
proxy_pass http://localhost:5029/server_alias/web_service_name;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
该请求应该发送到在端口5029上侦听的apache服务器。我做错了什么?
我为任何面临相同问题的人找到了答案。只有auth_request路径中缺少一个反斜杠。
location /my_location/ {
auth_request /access/auth/;
try_files $uri =404;
}