【发布时间】:2019-04-18 17:52:08
【问题描述】:
可能是 this question 的副本,但它没有答案,我在那里尝试了该建议,但无法使其发挥作用。我需要在代理之前授权每个请求,我试图通过 cookie 来做到这一点,但是 cookie 值没有在任何后续请求上设置。互联网上的大多数地方都推荐如下内容
server {
auth_request /auth;
location /auth {
internal;
proxy_pass http://auth:8080/auth;
auth_request_set $saved_set_cookie $upstream_http_set_cookie;
add_header Set-Cookie $saved_set_cookie;
}
}
但这似乎不起作用。如上问题所述,我什至尝试使用自定义标题来查看是否可以看到它,但它不起作用。
server {
auth_request /auth;
location /auth {
internal;
proxy_pass http://auth:8080/auth;
auth_request_set $saved_set_cookie $upstream_http_set_cookie;
add_header X-COOKIE-TEST $saved_set_cookie;
}
}
如果我直接访问身份验证服务器,我确实会看到 cookie 已设置
【问题讨论】:
标签: authentication nginx cookies