Welcome Guest, Not a member yet? Register   Sign In
Session over subdomains
#1

[eluser]Nekluh[/eluser]
I have a strange problem.

My sessions from
sub1.domain.com
doesn't exist on
sub2.domain.com

My config is
$config['cookie_prefix'] = "";
$config['cookie_domain'] = ".domain.com";
$config['cookie_path'] = "/";

If I set a cookie using set_cookie() using the same setting
the cookie can be read on both subdomains. But not the session.
Very strange.

I'm sure the config.cfg is read, because other stuff in there are working.
#2

[eluser]WanWizard[/eluser]
Weird, because the session cookie is created with set_cookie as well, using the config values as-is:
Code:
setcookie(
    $this->sess_cookie_name,
    $cookie_data,
    $expire,
    $this->cookie_path,
    $this->cookie_domain,
    0
);

If you check using firebug, live http headers, fiddler, etc, what is the exact cookie being set in the HTTP header in both cases?
#3

[eluser]Nekluh[/eluser]
When landing on sub.flauntkit.com on the site the first time I get the header:

Set-Cookie flauntkit_session=6b9amib8m2iuapibvi0n7t4gd7; path=/

Looking at the cookie handler in firefox I have received one cookie:
Name: flauntkit_session
Content: 6b9amib8m2iuapibvi0n7t4gd7
Host: sub.flauntkit.com

Looking at other sites' cookies I see they dont even have the "Host:" value
but insted they have a "Domain:" value.

When using set_cookie() myself I get a cookie with a "Domain:" value .flauntkit.com, which travels with me over subdomains.

So for some reason, codeigneter doesn't set a "Domain:" value when setting the session cookie.
#4

[eluser]Nekluh[/eluser]
OK

I've found the problem.
I had forgotten I was using another session library of
* @author Darren Nolan - Rapid Hosting
* @LinK http://www.rapidhosting.com.au

So that wasn't reading from the session domain settings.




Theme © iAndrew 2016 - Forum software by © MyBB