Welcome! Log In Create A New Profile

Advanced

[nginx] Proxy: fixed incorrect URI change due to if (ticket #86).

Maxim Dounin
December 09, 2014 10:54AM
details: http://hg.nginx.org/nginx/rev/aeea0522332f
branches:
changeset: 5939:aeea0522332f
user: Maxim Dounin <mdounin@mdounin.ru>
date: Tue Dec 09 18:22:39 2014 +0300
description:
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.

diffstat:

src/http/modules/ngx_http_proxy_module.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diffs (19 lines):

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) {

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Proxy: fixed incorrect URI change due to if (ticket #86).

Maxim Dounin 604 December 09, 2014 10:54AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 213
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready