好吧。本来想多写点的,现在没时间,太监了。
说下核心:客户端自定义的http header,在nginx的配置文件里能直接读取到。
条件:header必须用减号“-”分隔单词,nginx里面会转换为对应的下划线“_”连接的小写单词。
nginx配置:
| 代码如下 | 复制代码 |
| location / { if ($http_my_custom_header ~ (d+) ) { rewrite / https://www.111cn.net/ last; } } |
|
测试:
| 代码如下 | 复制代码 |
| wget --header="my-custom-header:1" -d https://www.111cn.net DEBUG output created by Wget 1.13.4 on linux-gnu. URI encoding = `UTF-8' --2014-04-28 09:48:40-- https://www.111cn.net/ Resolving www.111com.net (www.111com.net)... 172.31.30.70 Caching www.111com.net => 172.31.30.70 Connecting to www.111com.net |172.31.30.70|:80... connected. Created socket 3. Releasing 0x084e3e18 (new refcount 1). ---request begin--- GET / HTTP/1.1 User-Agent: Wget/1.13.4 (linux-gnu) Accept: */* Host: www.111com.net Connection: Keep-Alive my-custom-header: 1 ---request end--- HTTP request sent, awaiting response... ---response begin--- HTTP/1.1 302 Moved Temporarily Server: nginx/1.1.19 Date: Mon, 28 Apr 2014 09:48:40 GMT Content-Type: text/html Content-Length: 161 Connection: keep-alive Location: https://www.111cn.net |
|
疯狂医院达什医生中文版(Crazy Hospital)
疯狂医院达什医生最新版是一款医院模拟经营类游戏,逼真的场景画
宝宝庄园官方版
宝宝庄园官方版是一款超级经典好玩的模拟经营类型的手游,这个游
桃源记官方正版
桃源记是一款休闲娱乐类的水墨手绘风格打造的模拟经营手游。玩家
长途巴士模拟器手机版
长途巴士模拟器汉化版是一款十分比真好玩的大巴车模拟驾驶运营类
房东模拟器最新版2024
房东模拟器中文版是一个超级有趣的模拟经营类型的手游,这个游戏