# HG changeset patch # User Igor Sysoev # Date 1190486670 0 # Node ID 840b81d13a2f64d0bd4245cb5443c4281b0e86b5 # Parent fa67e7914b7036aeafe699e858aa841bc702005a r1340, r1341 merge: fix case when two directives proxy_pass http://backend; proxy_pass https://backend; both use one port - 80 or 443, that was defined first. diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -2237,6 +2237,7 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_ if (port == 80) { plcf->port.len = sizeof("80") - 1; plcf->port.data = (u_char *) "80"; + } else { plcf->port.len = sizeof("443") - 1; plcf->port.data = (u_char *) "443"; diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -3209,6 +3209,12 @@ ngx_http_upstream_add(ngx_conf_t *cf, ng continue; } + if (uscfp[i]->default_port && u->default_port + && uscfp[i]->default_port != u->default_port) + { + continue; + } + return uscfp[i]; }