diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2011-12-23 16:04:09 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2011-12-23 16:04:09 +0000 |
| commit | aa4492612bb4e80621680eeacb496c45166ac455 (patch) | |
| tree | aadbf5f463e2728a03cb3cabd746298b29f95227 | |
| parent | 2f6e243499d3ef0a8bbb811c68b1a169a4f8b71c (diff) | |
| download | nginx-aa4492612bb4e80621680eeacb496c45166ac455.tar.gz nginx-aa4492612bb4e80621680eeacb496c45166ac455.tar.bz2 | |
Proxy: made proxy_pass with variables more consistent.
If proxy_pass was used with variables and there was no URI component,
nginx always used unparsed URI. This isn't consistent with "no variables"
case, where e.g. rewrites are applied even if there is no URI component.
Fix is to use the same logic in both cases, i.e. only use unparsed URI if
it's valid and request is the main one.
Diffstat (limited to '')
| -rw-r--r-- | src/http/modules/ngx_http_proxy_module.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index 5ce875f62..a525cd922 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -736,9 +736,6 @@ ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx, url.uri.len++; url.uri.data = p - 1; } - - } else { - url.uri = r->unparsed_uri; } ctx->vars.key_start = u->schema; @@ -806,7 +803,7 @@ ngx_http_proxy_create_key(ngx_http_request_t *r) return NGX_ERROR; } - if (plcf->proxy_lengths) { + if (plcf->proxy_lengths && ctx->vars.uri.len) { *key = ctx->vars.uri; u->uri = ctx->vars.uri; @@ -916,7 +913,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r) loc_len = 0; unparsed_uri = 0; - if (plcf->proxy_lengths) { + if (plcf->proxy_lengths && ctx->vars.uri.len) { uri_len = ctx->vars.uri.len; } else if (ctx->vars.uri.len == 0 && r->valid_unparsed_uri && r == r->main) @@ -1022,7 +1019,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r) u->uri.data = b->last; - if (plcf->proxy_lengths) { + if (plcf->proxy_lengths && ctx->vars.uri.len) { b->last = ngx_copy(b->last, ctx->vars.uri.data, ctx->vars.uri.len); } else if (unparsed_uri) { |
