Cant make Proxy Next Upstream work

Agus agus.262 at
Mon Oct 5 19:54:25 UTC 2015

Hi guys!

I have a configuration taht cant make it work Here is the data. First i
check taht if i come from location2 with geo so taht it uses lcoation 2
backends.. But as there are things taht are not in location2 i need to go
to default location in case there is an 404 o 403 as git shows me 403
although the repo doesnt exist.

This isnt working.. i receive the 403 form location2 but never tries the
backup server.. Any help or any other way to do it will greatly appreciate!

geo $upstream {
        default git_loc1;

        x.x.0.0/16 git_loc1;
        x.x.0.0/16 git_loc2;

upstream git_loc1 {
        hash $remote_addr$remote_user;

        server git1.loc1.bla:443;
        server git2.loc1.bla:443;

upstream git_loc2 {

        server git.loc2.bla:443;

        server git.loc1.bla:443 backup;

server {
        listen 80;
        server_name git.bla;

        error_log  logs/git-error.log  debug;
        access_log logs/git_access.log upstreamlog;

        location / {
                proxy_intercept_errors on;
                error_log logs/git-pp-error.log debug;
                proxy_next_upstream error http_403 http_404;
                proxy_pass https://$upstream;


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list