Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Ensure the current URI subject to internal redirects and rewrites is …


Using $request_uri will cause an infinite loop if an internal redirect
(X-Accel-Redirect) is subrequested back to Passenger, $uri is the value
we are actually interested in.

On the nginx wiki:

Fixes issue #433.
  • Loading branch information...
commit fd82697d9cc316bcf68a8cb5b2085b9572ed651c 1 parent 4880487
@loe loe authored FooBarWidget committed
Showing with 4 additions and 1 deletion.
  1. +3 −0  NEWS
  2. +1 −1  ext/nginx/Configuration.c
3  NEWS
@@ -10,6 +10,9 @@ Release 2.2.8
by passenger-install-nginx-module. As a result,
passenger-install-nginx-module fails on e.g. out-of-the-box Ubuntu
installations until the user manually installs OpenSSL. Issue #422.
+ * [Nginx] Fixed support for internal redirects and subrequests.
+ It is now possible to, for example, point X-Accel-Redirects to Phusion
+ Passenger-served URLs. Patch contributed by W. Andrew Loe III: issue #433.
* [Apache] Fixed a GnuTLS compatibility issue.
mod_gnutls can cause Phusion Passenger to crash because of an unchecked
NULL pointer. This problem has now been fixed: issue #391.
2  ext/nginx/Configuration.c
@@ -194,7 +194,7 @@ passenger_create_loc_conf(ngx_conf_t *cf)
DEFINE_VAR_TO_PASS("QUERY_STRING", "$query_string");
DEFINE_VAR_TO_PASS("REQUEST_METHOD", "$request_method");
- DEFINE_VAR_TO_PASS("REQUEST_URI", "$request_uri");
+ DEFINE_VAR_TO_PASS("REQUEST_URI", "$uri$is_args$args");
DEFINE_VAR_TO_PASS("SERVER_PROTOCOL", "$server_protocol");
DEFINE_VAR_TO_PASS("SERVER_SOFTWARE", "nginx/$nginx_version");
DEFINE_VAR_TO_PASS("REMOTE_ADDR", "$remote_addr");

0 comments on commit fd82697

Please sign in to comment.
Something went wrong with that request. Please try again.