Welcome Guest, Not a member yet? Register   Sign In
Session data & sub-domains
#1

[eluser]antiver[/eluser]
I have my domain setup so that any request sent to anything.mydomain.com is handled by a dedicated server, and apache virtual host settings pass all requests to the same CI install.

My goal, is to have addresses like http://antiver.mydomain.com/ be handled by http://mydomain.com/controller/function/antiver

Furthermore, I have my default controller ($route['default_controller']) happily detecting if http://username.mydomain.com/ actually contains a username, and calling the right controller/function to handle the request.

So here's the problem... when you login on http://mydomain.com , and then load http://username.mydomain.com , you're suddenly not logged in anymore. Session data isn't carrying over.

I read this thread-
http://ellislab.com/forums/viewthread/70819/
and tried both:
Code:
$config['cookie_domain'] = "";
(which was the default setting), and:
Code:
$config['cookie_domain'] = ".mydomain.com";

But in either case, the session data is being kept separately. Of course, I need this to work for an unlimited number of sub-domains (for any username.mydomain.com).

Any suggestions appreciated!
#2

[eluser]esra[/eluser]
Along with the cookie domain change, try using DB_Session to record your session data to your database. Change the session filename config value in the config files for your domain and subdomains to something like all_sessions. I experimented with this earlier and it seemed to work fine. I'm doing something similar for authorization. All of my Khaos ACL tables were renamed to have a fixed all_ prefix.

The above should work if the data for your domain and subdomains are stored in a single database. If this is not possible (need to use multiple databases) or if some of your subdomains are located on remote servers, I may have another solution but it involves using xml-rpc.




Theme © iAndrew 2016 - Forum software by © MyBB