LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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, 05: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, 05: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:24 PM
cookies in Firefox - can Google read Yahoo! cookies? nerdofdarkness Linux - Newbie 9 11-11-2013 02:04 AM
nginx + php-fpm and nginx modules fantasygoat Linux - Server 0 06-09-2011 01:21 PM
Nginx experts help me-problem when using Nginx php-fpm !!! HuMan-BiEnG Linux - Server 2 04-17-2011 03:30 PM
NGINX with PHP-FPM vis NGINX with Spawn-FCGI WhisperiN Linux - Server 1 03-15-2011 07:39 PM

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

All times are GMT -5. The time now is 11:00 AM.

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