]> git.kaiwu.me - nginx.git/commitdiff
r1340, r1341 merge:
authorIgor Sysoev <igor@sysoev.ru>
Sat, 22 Sep 2007 18:44:30 +0000 (18:44 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sat, 22 Sep 2007 18:44:30 +0000 (18:44 +0000)
fix case when two directives
    proxy_pass   http://backend;
    proxy_pass   https://backend;
both use one port - 80 or 443, that was defined first.

src/http/modules/ngx_http_proxy_module.c
src/http/ngx_http_upstream.c

index c8dca82ae098c363144ee66bd1dd17747b6a05c1..52f67b3055cdb2474ffd9fcb6f0c486fa0f4c44f 100644 (file)
@@ -2237,6 +2237,7 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
             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";
index 376b85fcd8cb0f686259e1b5567303c3c343828c..bc4567458dd679e80b82714e9590437ac628642b 100644 (file)
@@ -3209,6 +3209,12 @@ ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)
             continue;
         }
 
+        if (uscfp[i]->default_port && u->default_port
+            && uscfp[i]->default_port != u->default_port)
+        {
+            continue;
+        }
+
         return uscfp[i];
     }