Forum: NGINX variable on userid_domain

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Daniele M. (Guest)
on 2008-12-14 14:23
(Received via mailing list)
Hi all,

I'm trying to pass a variable $domain on userid_domain switch but it
doesn't work:

this is the result:
daniele@lara:~$ HEAD http://localhost
200 OK
Connection: close
Date: Fri, 12 Dec 2008 16:31:59 GMT
Accept-Ranges: bytes
Server: nginx/0.6.32
Content-Length: 151
Content-Type: text/html
Last-Modified: Wed, 30 Aug 2006 10:39:17 GMT
Client-Date: Fri, 12 Dec 2008 16:31:59 GMT
Client-Response-Num: 1
P3P: policyref="/w3c/p3p.xml", CP="CUR ADM OUR NOR STA NID"
Set-Cookie: test_cookie=AQAAf0lCkf93nyG2AwMEAg==; expires=Sat, 12-Dec-09
16:31:59 GMT; domain=$domain; path=/

as you can see domain is $domain

Here my "simplyfied configuration":

server {
        listen   80;
        server_name  localhost host1;

        set $domain "mydomain2";
        if ( $host ~ "host1" ) {
                set $domain "mydomain";

        userid          on;
        userid_name     test_cookie;
        userid_domain   $domain;
        userid_path     /;
        userid_expires  365d;
        userid_p3p      'policyref="/w3c/p3p.xml", CP="CUR ADM OUR NOR

how can i solve this (i'd like to avoid to create 2 different server
definition) ?

Igor S. (Guest)
on 2008-12-14 17:25
(Received via mailing list)
On Fri, Dec 12, 2008 at 05:38:04PM +0100, Daniele M. wrote:

> Content-Length: 151
> how can i solve this (i'd like to avoid to create 2 different server
> definition) ?

userid does not support variables.
As to cookie domain, it's by default host name.

Also, I do not recommend to create single server difinition for several
servers. Eventually servers will differ and you need to seperate them.
It's better to do it from the very start.
This topic is locked and can not be replied to.