配置 – 为什么我不能将proxy_set_header放在if子句中?
发布时间:2020-12-30 16:12:59 所属栏目: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.你想在这里实现什么? (编辑:莱芜站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- laravel-Nginx上的历史记录模式的Vue路由器服务器配置不起作
- node.js – 当我有Kubernetes时,nginx有什么意义?
- amazon-web-services – Elastic Beanstalk Http重定向到Ht
- Nginx配置未针对浏览器更新
- 扩展Nginx,PHP-FPM和MongoDB
- 在location {}块中指定nginx的ssl_certificate
- nginx:“/ root /index.html”禁止(13:权限被拒绝)
- nginx /index.html到/重写
- 如何在Nginx中为所有服务器设置默认指令? (Plesk的问题)
- Nginx中的HSTS:是否应该在子域服务器块中添加Strict-Trans