X-Accel-Redirect doesn't URL-decode paths

Hello,

I’m using the X-Accel-Redirect feature in Nginx, but it fails to send
some files (returning a 404) because it does not URL-decode the
requested path. It does work when the file name need not be
URL-decoded.

So, for example, I have a file called “Mudança_Climática.pdf” in
/srv/static (whose URL alias on Nginx is “/internal/static”), my
application would set the X-Accel-Redirect header to:
X-Accel-Redirect: /internal/static/Mudan%C3%A7a_Clim%C3%A1tica.pdf

But then, Nginx will try to look up that file in the filesystem as:
/srv/static/Mudan%C3%A7a_Clim%C3%A1tica.pdf

However, if I requested “Climate_Change.pdf”, it works.

This seems like a bug, isn’t it? Or is it a bad configuration?

Thanks in advance.

Posted at Nginx Forum:

Hello!

On Tue, Sep 07, 2010 at 11:20:08AM -0400, gustavo wrote:

X-Accel-Redirect: /internal/static/Mudan%C3%A7a_Clim%C3%A1tica.pdf

But then, Nginx will try to look up that file in the filesystem as:
/srv/static/Mudan%C3%A7a_Clim%C3%A1tica.pdf

However, if I requested “Climate_Change.pdf”, it works.

This seems like a bug, isn’t it? Or is it a bad configuration?

X-Accel-Redirect expected to contain non-encoded URI. This isn’t
really right, but it’s how it currently works.

Maxim D.

Hi, Maxim.

Thank you very much for your response.

Maxim D. Wrote:

X-Accel-Redirect expected to contain non-encoded
URI. This isn’t
really right, but it’s how it currently works.

It’s not only against HTTP, it’s also a big limitation because gateways
like Python’s mod_wsgi (or any gateway for Python/WSGI) would refuse to
send decoded values in HTTP headers.

Do you know if is there a workaround for this?

Thanks in advance.

Posted at Nginx Forum: