Welcome! Log In Create A New Profile

Advanced

[BUG] url not properly handled for try_files and error_page redirect in ngx_http_internal_redirect

lanshun zhou
December 16, 2011 11:36AM
url is changed in ngx_http_internal_redirect, but some flags like
r->valid_unparsed_uri
are not always reset. Then in ngx_http_proxy_create_request the
original uri is sent to
backends instead of the new one.

This affects the redirects in ngx_http_core_try_files_phase and
ngx_http_send_error_page.

simple fix:

diff -ruN nginx-1.1.11/src/http/ngx_http_core_module.c
nginx-1.1.11_zls/src/http/ngx_http_core_module.c
--- nginx-1.1.11/src/http/ngx_http_core_module.c 2011-12-06
21:23:37.000000000 +0800
+++ nginx-1.1.11_zls/src/http/ngx_http_core_module.c 2011-12-16
16:31:27.751927635 +0800
@@ -2481,6 +2481,8 @@

r->uri = *uri;

+ r->valid_unparsed_uri = 0;
+
if (args) {
r->args = *args;

diff -ruN nginx-1.1.11/src/http/ngx_http_upstream.c
nginx-1.1.11_zls/src/http/ngx_http_upstream.c
--- nginx-1.1.11/src/http/ngx_http_upstream.c 2011-12-09
21:19:57.000000000 +0800
+++ nginx-1.1.11_zls/src/http/ngx_http_upstream.c 2011-12-16
16:30:25.399218885 +0800
@@ -1895,8 +1895,6 @@
r->method = NGX_HTTP_GET;
}

- r->valid_unparsed_uri = 0;
-
ngx_http_internal_redirect(r, uri, &args);
ngx_http_finalize_request(r, NGX_DONE);
return NGX_DONE;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[BUG] url not properly handled for try_files and error_page redirect in ngx_http_internal_redirect Attachments

lanshun zhou 1071 December 16, 2011 11:36AM

Re: [BUG] url not properly handled for try_files and error_page redirect in ngx_http_internal_redirect

Maxim Dounin 436 December 16, 2011 12:18PM

Re: [BUG] url not properly handled for try_files and error_page redirect in ngx_http_internal_redirect

Maxim Dounin 496 December 19, 2011 09:14AM



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

Online Users

Guests: 89
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready