Opened 6 years ago

#430 new enhancement

Allow variables in userid_domain

Reported by: www.google.com/accounts/o8/id?id=AItOawn5DrCTa1qGbEbZtojtpSRBjA4XoK6W04A Owned by:
Priority: minor Milestone:
Component: nginx-module Version:
Keywords: userid domain Cc:
uname -a: Linux hostname 2.6.32-5-amd64 #1 SMP Mon Sep 23 23:29:01 UTC 2013 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.4.2 TLS SNI support enabled configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-pcre-jit --with-debug --with-file-aio --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-mail --with-mail_ssl_module --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/headers-more-nginx-module --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-auth-pam --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-cache-purge --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-dav-ext-module --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-development-kit --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-echo --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/ngx-fancyindex --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-push-stream-module --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-lua --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-upload-progress --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-upstream-fair --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-syslog --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/ngx_http_pinba_module --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/ngx_http_substitutions_filter_module --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/ngx_pagespeed --add-module=/usr/src/nginx/source/nginx-1.4.2/debian/modules/nginx-x-rid-header --with-ld-opt=-lossp-uuid

Description

It would be useful to use variables when setting userid_domain. In my case we have a multidomain configuration, with multiple subdomains, and the cookie should be valid for the top domain.

Ex: The domain is foo.bar

We have this subdomains: www.foo.bar and images.foo.bar
When I access to www.foo.bar, userid send me a cookie, only for "www.foo.bar" domain. Inside the index.html of www.foo.bar there are some <img ...> pointing to images.foo.bar. When the browser try to get these images, it gets another userid cookie, because the domain has changed.

If I could tell userid_domain to set cookie domain to "foo.bar" this problem should disappear. After all it was the same user.

Now, if I use variables in userid_domain this is what happens:
In vhost config:

set
userid_domain $mydomain;

I get this Set-Cookie header:

Set-Cookie: atr_ut=wKgBglJw9HQPZBr0AwMDAg==; expires=Wed, 29-Oct-14 11:58:44 GMT; domain=$mydomain; path=/

Thanks.

Change History (0)

Note: See TracTickets for help on using tickets.