Nginx+oauth2 "找不到主机"

问题描述

我有 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 模块时需要考虑什么?我还注意到,使用代理时,全局标头也不会发送到浏览器。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)