upstream name was tried to resolve
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index a358ce2..a917dcf 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2843,7 +2843,7 @@
     uscfp = umcf->upstreams.elts;
 
     for (i = 0; i < umcf->upstreams.nelts; i++) {
-        if (uscfp[i]->port != u->portn
+        if ((uscfp[i]->port && uscfp[i]->port != u->portn)
             || uscfp[i]->host.len != u->host.len
             || ngx_strncasecmp(uscfp[i]->host.data, u->host.data, u->host.len)
                != 0)