nginx的headers_more模块用于 添加、修改或清除 请求/响应头,该模块不是nginx自带的,默认不包含该模块,需要另外安装。幸运的是openresty默认包含了该模块,可以直接使用。

该模块主要有4个指令

more_set_headers 用于 添加、修改、清除 响应头
more_clear_headers 用于 清除 响应头
more_set_input_headers 用于 添加、修改、清除 请求头
more_clear_input_headers 用于 清除 请求头
以下是使用示例:

1. 删除响应头
去掉X-Powered-By 和 Server响应头:

more_clear_headers X-Powered-By Server;
删除前:

删除后:

2.自定义响应头

去掉X-Powered-By响应头,增加一个X-Author响应头,修改Server响应头为Apache,伪装一下。

more_clear_headers X-Powered-By;
more_set_headers "X-Author: Lcy" "Server: Apache 2.4";
效果:

3. 修改请求头

把query_string 中的cid参数改写成Cookie。

if ($arg_cid) {
more_set_input_headers "Cookie: PHPSESSID=$arg_cid";
}
效果如下:

4.参考
该模块的详细文档可参考 headers-more-nginx-module 。
---------------------
作者:chunyuan314
来源:CSDN
原文:https://blog.csdn.net/chunyuan314/article/details/81737303
版权声明:本文为博主原创文章,转载请附上博文链接!

nginx的headers_more模块的使用的更多相关文章

  1. nginx利用geo模块做限速白名单以及geo实现全局负载均衡的操作记录

    geo指令使用ngx_http_geo_module模块提供的.默认情况下,nginx有加载这个模块,除非人为的 --without-http_geo_module.ngx_http_geo_modu ...

  2. php5.5安装及phpmyadmin&nginx配置php模块

    安装php5.5: 下载源地址:rpm -Uvh rpm包安装:yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php ...

  3. 为nginx增加nginx_http_concat模块

    为nginx增加nginx_http_concat模块 时间 2013-06-05 22:14:56  我行我思 原文  http://www.fanjun.me/?p=562 主题 Nginx 缘由 ...

  4. Nginx SPDY Pagespeed模块编译——加速网站载入

    在看<Web性能权威指南>的时候,看到了SPDY这货,于是便开始折腾起了这个了,也顺便把pagespeed加了进去. Nginx SPDY 引自百科~~ SPDY(读作“SPeeDY”)是 ...

  5. Nginx 的 RTMP 模块的在线统计功能 stat 在 multi-worker 模式下存在 Bug

    < 让你的 Nginx 的 RTMP 直播具有统计某频道在线观看用户数量的功能>一文介绍了 Nginx 的在线统计模块.         我们的在线直播服务使用了 Nginx 的 Rtmp ...

  6. RedHat7安装Nginx及第三方模块

    编译安装Nginx 先安装编译过程中所需依赖包# yum -y install gcc pcre-devel openssl-devel zlib-devel jemalloc(更好的内存管理)# w ...

  7. nginx利用limit模块设置IP并发防CC攻击

    nginx利用limit模块设置IP并发防CC攻击 分类: 系统2013-01-21 09:02 759人阅读 评论(0) 收藏 举报 来源:http://blog.xencdn.net/nginx- ...

  8. OSX安装nginx和rtmp模块(rtmp直播服务器搭建)

    1.安装Homebrew,执行命令 1 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/ma ...

  9. nginx上传模块nginx_upload_module和nginx_uploadprogress_module模块进度显示,如何传递GET参数等。

    ownload:http://www.grid.net.ru/nginx/download/nginx_upload_module-2.2.0.tar.gzconfigure and make : . ...

随机推荐

  1. VirtualBox没有权限访问共享文件夹

    将用户添加至vboxsf组 命令: sudo adduser ly vboxsf 搞定!

  2. 洛谷 P1602 Sramoc问题

    题目描述 话说员工们整理好了筷子之后,就准备将快餐送出了,但是一看订单,都傻眼了:订单上没有留电话号码,只写了一个sramoc(k,m)函数,这什么东西?什么意思?于是餐厅找来了资深顾问团的成员,YQ ...

  3. mongodb--入门知识点

    命令 mongo.exe,命令行客户端Shell工具. mongod.exe,数据库服务程序. mongodump.exe,数据库备份程序. mongoexport.exe,数据导出工具. mongo ...

  4. Java-基本输入输出

    Scanner sc = new Scanner(System.in); System.out.println("Please input the path:"); String ...

  5. ruby for in 循环中改变i的值无效

    ruby for in 循环中改变i的值无效 for j in 1..5 puts "#{j}hehe" j = j + 2 #break end 在循环中,使用j = j + 2 ...

  6. 车载导航系统中GPS的定位

    首先购买的车载导航系统有GPS信号接受功能,能够接收GPS的经纬度信号,然后导航终端里面安装的导航地图能够非常详细的显示详细的经纬度坐标和地物信息.导航终端通过接收器接收到卫星24小时不间断发射的免费 ...

  7. javascript的==和===,以及if(xxx)总结

    转载请注明 本文出自:http://blog.csdn.net/nancle 首先说==和=== 首先说明一个非常特殊的值NaN, typeof(Nav)得到'number',可是NaN不等于不论什么 ...

  8. Android与JS互相调用以及注意

    近期项目中常常使用Html5而Android与JS调用常常会用到,这里记录一下,測试系统5.0以上. 这里先贴一下源代码 Activity: package jwzhangjie.com.webvie ...

  9. 2016.04.06,英语,《Vocabulary Builder》Unit 10

    put, from the Latin verb putare, meaning 'to think, consider, or believe'. reputation: [ˌrepju'teɪʃn ...

  10. POJ - 3280Cheapest Palindrome-经典区间DP

    POJ - 3280 Cheapest Palindrome Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & ...