URL decoding a variable and/or using rewite effectively

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:
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,


Posted at Nginx Forum: