]> git.kaiwu.me - nginx.git/commitdiff
allow "proxy_pass http://$backend" without URI part
authorIgor Sysoev <igor@sysoev.ru>
Sun, 15 Nov 2009 11:36:12 +0000 (11:36 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 15 Nov 2009 11:36:12 +0000 (11:36 +0000)
src/http/modules/ngx_http_proxy_module.c

index 8f169fe4368e9b9644045569df8c6629887c7173..e0f17e70ac26665a608652697b0d90e6d462961d 100644 (file)
@@ -724,17 +724,22 @@ ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx,
         return NGX_ERROR;
     }
 
-    if (url.uri.len && url.uri.data[0] == '?') {
-        p = ngx_pnalloc(r->pool, url.uri.len + 1);
-        if (p == NULL) {
-            return NGX_ERROR;
-        }
+    if (url.uri.len) {
+        if (url.uri.data[0] == '?') {
+            p = ngx_pnalloc(r->pool, url.uri.len + 1);
+            if (p == NULL) {
+                return NGX_ERROR;
+            }
 
-        *p++ = '/';
-        ngx_memcpy(p, url.uri.data, url.uri.len);
+            *p++ = '/';
+            ngx_memcpy(p, url.uri.data, url.uri.len);
 
-        url.uri.len++;
-        url.uri.data = p - 1;
+            url.uri.len++;
+            url.uri.data = p - 1;
+        }
+
+    } else {
+        url.uri = r->unparsed_uri;
     }
 
     ctx->vars.key_start = u->schema;