Configure sub-domain cookies

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Configure sub-domain cookies

Post by alex.barylski »

I have three applications (custom built) all of which run off the same physical server but I am using virtual hosts to partition the server, something like:

rpi.mydomain.com
erp.mydomain.com
crm.mydomain.com

Each application has it's own tables, this includes user/authentication tables. I want to keep each application away the others tables directly and instead have each application interact via a basic web service, returning response as JSON. Problem is, my current configuration, when I login to the ERP system, I see a new session file is created, where ideally I would prefer to have each application shared a single session file so a single login will allow users to switch applications without having to login to each all over again.
; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =
What should these values be in order to allow sharing sessions across sub-domains???

Cheers,
Alex
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Configure sub-domain cookies

Post by Darhazer »

try with ".mydomain.com" for the cookie domain (the dot in the beginning is important part)
Never tried it myself, but this is the way it would work if you use the setcookie function()
Post Reply