配置 – 为什么我不能将proxy_set_header放在if子句中?
发布时间:2020-12-30 14:04:18 所属栏目: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.你想在这里实现什么? (编辑:岳阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- NGINX和SPDY v2,v3和v3.1?
- nginx/1.10.1上的未知指令“geoip_country”
- ssl-使用HTTP / 2时Safari无法给出响应
- php-从nginx将参数传递给auth_request模块
- ruby-on-rails – mod_rails和Paperclip问题Paperclip :: N
- linux – 如何在nginx中限制对动态生成位置的访问?
- Nginx:如何防止在代理上缓存ajax请求?
- linux-用apt-get vs PPA安装Node-有什么区别?
- 使用apt-get install nginx后重新编译nginx
- nginx-在浏览器中检测HTTP2 / SPDY支持
推荐文章
站长推荐
- 配置 – 为什么我不能将proxy_set_header放在if子
- python – 当通过nginx代理时,Flask应用程序提供
- javascript – 502使用ExpressJS与nginx时网关不
- nginx将文件类型传递给后端服务器
- 为nginx使用多个密码文件
- nginx/1.10.1上的未知指令“geoip_country”
- nginx: [warn] conflicting server name on 0.0.
- if-statement-仅在存在cookie的情况下如何有条件
- ruby-on-rails – 502 Bad Gateway/rails 4/ngin
- ubuntu – chef-solo错误Errno :: ENOENT:没有这
热点阅读