`
sillycat
  • 浏览: 2487210 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

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


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics