Codeigniter Sessions by Subdomain

I have several subdomains, and I'm trying to use sessions in subdomains.

http://example.com
http://subdomain.example.com

I also set the cookie domain in config.php

$config['cookie_domain'] = ".example.com";

User session data, as well as flashdata, are empty when used in another domain. Im using the same session table as for the CI instance

+4
source share
3 answers

From the following solution: Session sharing

Both cookie_domain and cookie must be set

$config['cookie_domain'] = ".example.com";
$config['cookie_prefix'] = "example_";
+4
source

ground floor right but not clear reason

Reasons: from: https://ellislab.com/forums/viewthread/131851/#651233

CIs, , cookie . cookie, .

".domain.com, " *.domain.com.

0

Only part required $config['cookie_domain'], $config['cookie_prefix']- just to make things clear, or you have some sort of subdomain that uses the same domain, but does not want it to be shared.

0
source

Source: https://habr.com/ru/post/1534153/


All Articles