Forum: NGINX Repost: Inconsistent URL encoding in X-Accel-Redirect

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
87d08bdf14ef944738d2a81105b12606?d=identicon&s=25 Brian Moran (Guest)
on 2009-05-06 01:56
(Received via mailing list)
Sorry for the repost :: can anyone else confirm what we're seeing? :
I believe I've found an inconsistency in url encoding of
X-Accel-Redirect requests.

The URL that I'm providing in my X-Accel-Redirect header looks something
like:
/BACKING_HOST_LOCATION/Green%20Apple.gif?param1=TzJPvoCEV34&param2=U%2F8%3D

When this is supplied to nginx, the PATH part of the url gets url
encoded, however the parameters are passed untouched to the upstream
(sniffed with wireshark):

GET /Green%2520Apple.gif?param1=TzJPvoCEV34&param2=U%2F8%3D

(everything BEFORE the ? is urlencoded, the params are not)

I have a really, really gross hack where I only url encode the
parameters to be supplied, and leave the path alone, then pass to nginx
but this seems like a bug to me.

It would be convenient to have greater control of the the
X-Accel-Redirect urlencoding process; there are some times when I'd like
to supply a pre-encoded URL and pass it unchanged to the upstream.

I have tried this in 0.7.6, believe it also occurs in 0.6.x

bmoran -a-t- onehub.com
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-05-06 06:54
(Received via mailing list)
On Tue, May 05, 2009 at 04:44:39PM -0700, Brian Moran wrote:

> (sniffed with wireshark):
> X-Accel-Redirect urlencoding process; there are some times when I'd like
> to supply a pre-encoded URL and pass it unchanged to the upstream.
>
> I have tried this in 0.7.6, believe it also occurs in 0.6.x

Internally nginx uses unescaped URIs (PATH part), therefore it accepts
unescaped URI in X-Accel-Redirect.
87d08bdf14ef944738d2a81105b12606?d=identicon&s=25 Brian Moran (Guest)
on 2009-05-12 00:05
(Received via mailing list)
Igor Sysoev wrote:
><SEE PREVIOUS MESSAGE>
> Internally nginx uses unescaped URIs (PATH part), therefore it accepts
> unescaped URI in X-Accel-Redirect.

Can you tell me if the URI parameters are treated differently than the
base URL?  As I mentioned in my previous post, it seems that parameters
are NOT URLencoded by nginx on an X-Accel-redirect (but the base-part
is).
This topic is locked and can not be replied to.