LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-19-2016, 04:37 AM   #1
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Rep: Reputation: 30
nginx cookies with proxy_path


Hello all,

I've been trying to set up nginx so that if a user has a cookie 'DEV' they are redirected to one group of servers, however if they do *not* have this cookie set they visit another group of servers, I have tried a few things but cannot get it working, here is my current code:

Code:
upstream developers {
        server 10.211.55.1;
        server 10.211.55.2;
}

upstream production {
        server 10.211.55.9 max_fails=3 fail_timeout=10s;
        server 10.211.55.10 max_fails=3 fail_timeout=10s;
        server 10.211.55.11 backup;
}

server  {
        listen 80 default_server;
        root /usr/share/nginx/html;

        location / {
                if ($http_cookie ~* 'DEV') {
                        proxy_pass http://developers;
                        break;
                }
                proxy_pass http://production;
        }
}
I am always redirected to developers server
 
Old 05-19-2016, 04:40 PM   #2
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Original Poster
Rep: Reputation: 30
I have done some more digging, and I think that nginx is returning a cached response, so I have tried to disable caching, but I still get the same error:

Code:
        add_header Cache-Control no-cache;
        proxy_cache off;
noticed in firebug:
Code:
304 Not Modified
	
10.211.55.1
	
59 B
	
10.211.55.1:80
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What cookies does linuxquestions send a user? Must I enable cookies to keep logged in? winger9 Linux - Newbie 2 01-18-2014 07:24 PM
cookies in Firefox - can Google read Yahoo! cookies? nerdofdarkness Linux - Newbie 9 11-11-2013 01:04 AM
nginx + php-fpm and nginx modules fantasygoat Linux - Server 0 06-09-2011 12:21 PM
Nginx experts help me-problem when using Nginx php-fpm !!! HuMan-BiEnG Linux - Server 2 04-17-2011 02:30 PM
NGINX with PHP-FPM vis NGINX with Spawn-FCGI WhisperiN Linux - Server 1 03-15-2011 06:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration