Skip to content

Commit

Permalink
Better handling of late upstream creation.
Browse files Browse the repository at this point in the history
Configuration with duplicate upstream blocks defined after first use, i.e.
like

    server {
        ...
        location / {
            proxy_pass http://backend;
        }
    }

    upstream backend { ... }
    upstream backend { ... }

now correctly results in "duplicate upstream" error.

Additionally, upstream blocks defined after first use now handle various
server directive parameters ("weight", "max_fails", etc.).  Previously
configuration like

    server {
        ...
        location / {
            proxy_pass http://backend;
        }
    }

    upstream backend {
        server 127.0.0.1 max_fails=5;
    }

incorrectly resulted in "invalid parameter "max_fails=5"" error.
  • Loading branch information
mdounin committed Sep 27, 2011
1 parent b16918e commit 886c629
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/http/ngx_http_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -4335,6 +4335,10 @@ ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)
continue;
}

if (flags & NGX_HTTP_UPSTREAM_CREATE) {
uscfp[i]->flags = flags;
}

return uscfp[i];
}

Expand Down

0 comments on commit 886c629

Please sign in to comment.