[Bug] X-Accel-Redirect

rovervr nginx-forum at nginx.us
Wed Sep 8 17:53:14 MSD 2010


Hi everyone,

I got a server which serves Data to a client ( in my case MP3s ). The
MP3s are saved in a storage directory in the form Artist - Title.mp3

I'm using X-Accel-Redirect to serve the files from the storage dir to
the user. This workes fine for most cases but fails for special chars
like the question mark. I already tried encoding it - but the char
always gets stripped like in Query strings. But since it's not an url
I'm providing no stripping should take place. Here are my results: 


[b]Example Filename is:  /ext/53665/Katy Perry - Who Am I Living
For?.mp3[/b]

[b]Plain:[/b] 
open() "/ext/53665/Katy Perry - Who Am I Living For" failed (2: No such
file or directory)

[b]urlencoded:[/b] 
open()
"/usr/local/nginx/html%2Fdl%2F53665%2FKaty+Perry+-+Who+Am+I+Living+For%253F.mp3"
failed (2: No such file or directory)

[b]Rawurlencoded:[/b] 
 open()
"/usr/local/nginx/html%2Fdl%2F53665%2FKaty%20Perry%20-%20Who%20Am%20I%20Living%20For%3F.mp3"
failed (2: No such file or directory)

[b]Replaced ? with \?[/b]
open() "/ext/53665/Katy Perry - Who Am I Living For\" failed (2: No such
file or directory)

[b]Escaped ? to %3F[/b]
open() "/ext/53665/Katy Perry - Who Am I Living For%3F.mp3" failed (2:
No such file or directory)

It seems like X-Accel-Redirect treats the path as url instead of a
realpath - or even doesn't apply any decoding on the subrequest.

best regards,

Volker

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,128346,128346#msg-128346




More information about the nginx mailing list