nginx请求头设置及校验


1、Nginx指令add_header和proxy_set_header的区别

  proxy_set_headerNginx设置请求头信息给上游服务器,add_headerNginx设置响应头信息给浏览器。

参考https://blog.csdn.net/qq_30038111/article/details/95211271

 

2、获取请求头信息

  比如我们自定义header为X-Real-IP,通过第二个nginx获取该header时需要这样:

  $http_x_real_ip; (一律采用小写,而且前面多了个http_,且横杠X-Real-IP变成了下划线x_real_ip)

参考https://www.cnblogs.com/linkenpark/p/7646402.html

  https://blog.csdn.net/weixin_42133899/article/details/112884375

  https://blog.csdn.net/pf1234321/article/details/83072550


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM