URL decoding a variable and/or using rewite effectively

kung_fu_mike nginx-forum at nginx.us
Tue Nov 22 17:10:49 UTC 2011


Thank you in advance to anyone who can point me in the right direction.

We currently use nginx as an asset server. Requests are made to the
asset server in the form of:
http://downloads.ourdomain.com?unique_key=MD5hashOFstuff&name=the_nice_file_name(that
might have quotes or spaces)

The unique key is the actual name of the file, however we use $arg_NAME
in the headers to control the downloaded name. eg:
add_header    Content-Disposition "attachment;filename=$arg_NAME.xslx";
(yes they are excel files).

Our current issue is that space, parenthesis and other characters become
URL encoded in the variable. As such, the file-name (as it appears in
download) is not quite what we would like. My research has led me to
find that there is currently no access to a 'url-decode' style function.
I was curious, though, if there might be another method someone could
think to employ. Perhaps I have access to regular expression replace
style functionality that I am unaware of. Something that simple, would
more then likely solve all of the issues for this particular case.

Thank you for taking the time to read this,

-Mike
(kung_fu_mike)

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



More information about the nginx mailing list