Opened 10 years ago

Last modified 4 months ago

#640 new enhancement

enable usage of $ in variable

Reported by: Csaba Tóth Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.7.x
Keywords: Cc:
uname -a: Linux juno 3.13.4-gentoo-06 #1 SMP Sat Feb 22 16:43:21 CET 2014 x86_64 Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz GenuineIntel GNU/Linux
nginx -V: nginx version: nginx/1.7.4
TLS SNI support enabled
configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log --pid-path=/run/ --lock-path=/run/lock/nginx.lock --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib64 --http-log-path=/var/log/nginx/access_log --http-client-body-temp-path=//var/lib/nginx/tmp/client --http-proxy-temp-path=//var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=//var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=//var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=//var/lib/nginx/tmp/uwsgi --with-file-aio --with-aio_module --with-ipv6 --with-pcre --with-pcre-jit --without-http_geo_module --without-http_ssi_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_perl_module --with-http_realip_module --with-http_spdy_module --with-http_stub_status_module --with-http_realip_module --add-module=external_module/nginx-upload-progress-module-0.9.1 --add-module=external_module/nginx-rtmp-module-1.1.4 --add-module=external_module/nginx-dav-ext-module-0.0.3 --with-http_ssl_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --user=nginx --group=nginx


I would like to set this header in a location:

proxy_set_header X_DBFILTER '^db-main$';

But it fails:
nginx: [emerg] invalid variable name in /etc/nginx/nginx.conf:121

I tried these, but again fails:

proxy_set_header X_DBFILTER '^db-main\$';
proxy_set_header X_DBFILTER '^db-main$$';

Please make it to work, it would be a very basic functionality!
My suggestion is to make the $$ chars to mean the $ char.

Change History (2)

comment:1 by Maxim Dounin, 8 years ago

Type: defectenhancement

comment:2 by, 3 years ago

To make this bug easier to find, it is about a literal dollar character in strings. I agree that $$ makes the most sense because any other character may already be present in existing configs which could corrupt them.

Note: See TracTickets for help on using tickets.