Welcome! Log In Create A New Profile

Advanced

URI escaping for X-Accel-Redirect and proxy_pass in 1.4.7 and 1.6.0

June 17, 2014 02:49AM
We are updating Nginx from 1.4.7 and 1.6.0 and noticed an error in our app likely related to the 1.5.9 change: now nginx expects escaped URIs in "X-Accel-Redirect" headers.

We have an internal location for proxying content from a backend HTTP system (Swift, actually). The location block looks like this:

location ~ ^/protected/swift/(http|https)/([A-Za-z0-9\.\-]+)/([1-9][0-9]+)/([A-Za-z0-9_]+)/(.*) {
internal;
proxy_set_header X-Auth-Token $4;
proxy_pass $1://$2:$3/$5;
proxy_hide_header Content-Type;
}

Nginx 1.4.7 functions as expected when sending X-Accel-Redirect: /protected/swift/http/HOST/PORT/TOKEN/v1/AUTH_test/content/image%20with%20spaces.jpg

Under 1.6.0 this fails. It produces a GET request to the backend decoded into spaces and so becomes an invalid HTTP request.

The workaround is to _double_ encode so as to send back "image%2520with%2520spaces.jpg" to Nginx but we can't roll this out until Nginx 1.6 because it breaks 1.4... but we can't roll out 1.6 until the code is there.

Is there a solution that works for both?
Subject Author Posted

URI escaping for X-Accel-Redirect and proxy_pass in 1.4.7 and 1.6.0

gwilym June 17, 2014 02:49AM

Re: URI escaping for X-Accel-Redirect and proxy_pass in 1.4.7 and 1.6.0

Jonathan Matthews June 17, 2014 08:16PM

Re: URI escaping for X-Accel-Redirect and proxy_pass in 1.4.7 and 1.6.0

gwilym July 03, 2014 03:41AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 124
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