# HG changeset patch # User Maxim Dounin # Date 1418138559 -10800 # Node ID aeea0522332f4007b30683ad2a8c77a9a4bd2371 # Parent cd2abf7e7740e291b1c4ee3d8fef4499d37e70d3 Proxy: fixed incorrect URI change due to if (ticket #86). In the following configuration request was sent to a backend without URI changed to '/' due to if: location /proxy-pass-uri { proxy_pass http://127.0.0.1:8080/; set $true 1; if ($true) { # nothing } } Fix is to inherit conf->location from the location where proxy_pass was configured, much like it's done with conf->vars. diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -2997,6 +2997,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t && conf->upstream.upstream == NULL && conf->proxy_lengths == NULL) { conf->upstream.upstream = prev->upstream.upstream; + conf->location = prev->location; conf->vars = prev->vars; conf->proxy_lengths = prev->proxy_lengths; @@ -3011,7 +3012,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t && (conf->upstream.upstream || conf->proxy_lengths)) { clcf->handler = ngx_http_proxy_handler; - conf->location = prev->location; } if (conf->body_source.data == NULL) {