Welcome! Log In Create A New Profile

Advanced

Location directive not working

Alex
March 25, 2014 08:32PM
I set up two upstream servers (server 1 and server 2) where I geotarget
people from specific countries: A

People from country A go to server 1 and the others go to server 2.

There are some uri s that must be served by server 1 when the person is in
country A. So I have created this directive. It works only when I include
one item, when I do (videos|events) it does not work

location ^~ /(videos|events) {
proxy_pass http://$server1$request_uri;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

I do it this way because there are URLs that contain videos and events
that must be served by server 1. For example,
domain.com/videos/playing-with-my-dog etc. When I reload this directive
nginx does not give me any errors, but when I try to access it from
country B, it does not work.

Thanks for all your help!

Alex

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Location directive not working

Alex March 25, 2014 08:32PM

Re: Location directive not working

Francis Daly March 26, 2014 05:04AM

Re: Location directive not working

Alex March 26, 2014 08:32AM

Re: Location directive not working

Francis Daly March 26, 2014 09:36AM

Re: Location directive not working

Alex March 26, 2014 12:46PM

Re: Location directive not working

Francis Daly March 26, 2014 01:16PM

Re: Location directive not working

B.R. March 26, 2014 01:40PM

Re: Location directive not working

Alex March 26, 2014 05:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 315
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready