Nginx+oauth2 "找不到主机"

时间:2021-06-17 06:52:01

标签: nginx nginx-reverse-proxy

我有 nginx+oauth2 设置。此表单有效:

set $upstream "http://web-server";

location /public/ {
  proxy_pass $upstream/public/;
}

location /protected/ {
  auth_request /_oauth2_send_request;
  proxy_pass_request_headers on;
  proxy_pass http://web-server/protected/;
}

但是当在 rev proxy 部分使用变量 $upstream 时,它给出错误“无法解析 web-server (3: Host not found)”

location /protected/ {
  auth_request /_oauth2_send_request;
  proxy_pass_request_headers on;
  proxy_pass $upstream/protected/;
}

即使访问 /public url 也会出错。我做错了什么?使用 oauth2 模块时需要考虑什么?我还注意到,使用代理时,全局标头也不会发送到浏览器。

0 个答案:

没有答案
相关问题