配置 – 为什么我不能将proxy_set_header放在if子句中?
发布时间:2020-12-30 17:02:11 所属栏目:Nginx 来源:互联网
导读:使用此配置:server { listen 8080; location / { if ($http_cookie ~* mycookie) { proxy_set_header X-Request $request; proxy_pass http://localhost:
使用此配置:
我重新加载nginx服务时出现此错误:
这个配置工作正常,但它没有做我想要的:
为什么我不能将proxy_set_header指令放在if子句中? 提前致谢! 与proxy_pass不同,您不能将proxy_set_header放在if块中.您只能将其放在http / server / location块中.所以你的第二个配置很好.参考:http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header
不知道$request变量是什么.它没有出现在nginx变量列表中:http://wiki.nginx.org/HttpCoreModule#Variables.你想在这里实现什么? (编辑:十堰站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |