Unable to escape $ sign in subs_filter

joseph-pg nginx-forum at forum.nginx.org
Thu Oct 12 05:57:34 UTC 2017


omar_h Wrote:
-------------------------------------------------------
> Hello,
> 
> I am trying to add some code to a page which contains a $ symbol. 
> However, I am getting the following error:
> 
> nginx: [emerg] invalid variable name
> 
> Here is a simple example of the config:
> 
> subs_filter 'example' '$';
> 
> Is there any way to escape the $ symbol?  The issue occurs even with
> single brackets, which normally should take strings as literal without
> any variable substitution.  It seems like a bug since this behavior
> should only occur with double brackets.
> 
> This issue was also discussed in the past, however, the workarounds
> don't work in my case
> https://forum.nginx.org/read.php?29,243808,243808#msg-243808
> https://forum.nginx.org/read.php?2,218536,218536#msg-218536

You need a backslash (\).

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,276801,276829#msg-276829



More information about the nginx mailing list