How to set $ into a variable?

Maxim Dounin mdounin at mdounin.ru
Fri Nov 18 14:16:12 UTC 2011


Hello!

On Thu, Nov 17, 2011 at 10:06:40PM -0500, bigplum wrote:

> nginx.conf: 
>  location / {
>     ....
>     set $var "$uri=200k"
>     ....
> 
> and run "curl localhost/"
> 
> The module use ngx_http_get_indexed_variable() for $var will get the
> string "/=200k", but I want the value is "$uri=200k". 
> 
> So any escape character supported in nginx.conf?

Right now there are no way to escape $ in arguments which support 
variables.  This is a bug.

Possible workaround is to use some variable defined with module 
which doesn't support variables, e.g. you may do so with geo:

    geo $dollar {
        default  "$";
    } 

    ...
    set $var "${dollar}uri=200k"
    ...

Maxim Dounin



More information about the nginx mailing list