Nginx Routing Based on Header Upgrade

Nginx Routing Based on Header Upgrade

Some Command I need
>sudo sbin/nginx -s reload
Reload the configuration file and restart the nginx

>sudo sbin/nginx -t
Test and check if my statements in conf/nginx.conf is correct.

>sudo sbin/nginx
Just Start the nginx process

Here is my configuration.

location / {   

   proxy_pass                  http://contentcenter2;    

   if ($http_x_header) {        

       proxy_pass              http://contentcenter1;    

   }
}

The idea is that first of all, make proxy_pass have default value.
Then check the header, if we have the customer header X_HEADER, we will go to another proxy_pass value, which point to another server URL.



References:
http://sillycat.iteye.com/blog/2074417
http://sillycat.iteye.com/blog/2074422


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值