加入收藏 | 设为首页 | 会员中心 | 我要投稿 商洛站长网 (https://www.0914zz.com/)- AI应用、CDN、边缘计算、云计算、物联网!
当前位置: 首页 > 运营中心 > Nginx > 正文

身份验证 C Nginx:是否可以从auth_request重新获得响应

发布时间:2023-12-19 08:20:06 所属栏目:Nginx 来源:DaWei
导读: 我正在为nginx使用auth模块. (http://nginx.org/en/docs/http/ngx_http_auth_request_module.html)
是否有可能以某种方式存储来自/ auth的响应,因此我可以将它作为请求主体发送到另一个端点

我正在为nginx使用auth模块. (http://nginx.org/en/docs/http/ngx_http_auth_request_module.html)
是否有可能以某种方式存储来自/ auth的响应,因此我可以将它作为请求主体发送到另一个端点.

location /private/ { auth_request /auth; proxy_pass ... proxy_set_body 'Here I want to put /auth response. How?'; } location = /auth { proxy_pass ... } 最佳答案 简短回答:

不,你不能.

答案很长:

您无法将响应的主体返回到auth_request.您可以使用auth_request_set指令获取响应中返回的标头:

location / { auth_request /auth; auth_request_set $auth_foo $upstream_http_foo; proxy_pass ... proxy_set_body $auth_foo; }

上面的配置会将$auth_foo变量设置为auth子请求的Foo标头的值.

(编辑:商洛站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章