Opened 10 years ago

Closed 10 years ago

#707 closed defect (wontfix)

Failure to process cookies containing a dot

Reported by: Alan Orth Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.7.x
Keywords: Cc:
uname -a: Linux vm04 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.7.9
built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed' --with-ipv6

Description

I have an application which sets a cookie of the form app.current.user.id and I'm attempting to use that with proxy_cache_bypass etc, but it seems nginx can't process that cookie.

config snippet:

location /test {
    return 200 'http_cookie=$http_cookie cookie_app.current.user.id=$cookie_app.current.user.id cookie_control=$cookie_control\n';
}

test:

$ curl -b "app.current.user.id=MjAxNS0wMS0yOFQxNDoxNTo0M1pYM0ZUSFBZOXVhQTh2c3Z4MlJMWDQ3;control=works" https://server/test -k
http_cookie=app.current.user.id=MjAxNS0wMS0yOFQxNDoxNTo0M1pYM0ZUSFBZOXVhQTh2c3Z4MlJMWDQ3;control=works cookie_app.current.user.id=.current.user.id cookie_control=works

Change History (1)

comment:1 by Maxim Dounin, 10 years ago

Resolution: wontfix
Status: newclosed

Variable names recognized by nginx are limited to alphanumeric characters and '_', so you can't use special $cookie_... variables to access cookies with '.' in their names. If needed, you can access such cookies using the $http_cookie variable (e.g., by using map with regular expressions).

Note: See TracTickets for help on using tickets.