aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_upstream.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2016-10-17 14:14:02 +0300
committerRuslan Ermilov <ru@nginx.com>2016-10-17 14:14:02 +0300
commit1f5d97cbf0005f7c8c6f15888ea5c36318da920a (patch)
treea0a7e85439bd5553433f78b4e2defac5d6d60960 /src/http/ngx_http_upstream.c
parent149fda55f730c38fb9e2c5b63370da92c0ad7c22 (diff)
downloadnginx-1f5d97cbf0005f7c8c6f15888ea5c36318da920a.tar.gz
nginx-1f5d97cbf0005f7c8c6f15888ea5c36318da920a.zip
Upstream: consistently initialize explicit upstreams.
When an upstream{} block follows a proxy_pass reference to it, such an upstream inherited port and default_port settings from proxy_pass. This was different from when they came in another order (see ticket #1059). Explicit upstreams should not have port and default_port in any case. This fixes the following case: server { location / { proxy_pass http://u; } ... } upstream u { server 127.0.0.1; } server { location / { proxy_pass https://u; } ... } but not the following: server { location / { proxy_pass http://u; } ... } server { location / { proxy_pass https://u; } ... } upstream u { server 127.0.0.1; }
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r--src/http/ngx_http_upstream.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 55bd47d02..828b7d726 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -5768,6 +5768,8 @@ ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)
if (flags & NGX_HTTP_UPSTREAM_CREATE) {
uscfp[i]->flags = flags;
+ uscfp[i]->port = 0;
+ uscfp[i]->default_port = 0;
}
return uscfp[i];