Jump to content

need advice on sessions across multiple domains...


slushpuppie

Recommended Posts

i have a site with several domains, which the client insists upon keeping available... so rather than have domain.net and domain.org just redirect to domain.com, they want you to be able to visit any of them via that url.

 

however many people post links in the forums on the site, which go to domain.com or www.domain.com, and if you're logged in on anything other than where the link goes you are seen as an invalid user and required to login on that domain.

 

so for example, i go to domain.com, login, and then click on a link to www.domain.com/awesome_page - i get an error that i'm not logged in and have to login again. i've read some about how you can set the session_cookie to ".domain.com", but what about if i'm on domain.net?

 

any ideas? any input at all? i'm kind of at a loss, and don't want to try implementing anything with my current level of understanding of this issue.

 

thanks in advance.

Link to comment
Share on other sites

That can't really be done because sessions use cookies, and the cookies are relevant to the domain.  You could set up a hack where you pass the session ID as a url param, and then write some custom code, but this will open up a whole can of worms, and also leaks the session ID into the urls, which will then be pasted by the users into the links leading to people attemting to session hijack other users.

 

Bottom line: you need to explain to the clients that their desire is incompatible with the technology platform being used.  There are solutions to these problems if the user wants them bad enough -- for example, consider something like an ID server that all the sites in the network utilize to provide identification.  This could be used, and as long as all the web servers in the network use the same session storage (this could be memcache, or an NFS mounted volume) you could construct a work around, but it is by no means a small job.  If they want it badly enough, will accept the recoding and probably substantial reworking of security code, you can get this to work.

Link to comment
Share on other sites

  • 2 months later...

Q: is there some reason you want to share the session information?

  Like yer sharing the same MySQL database or something?

 

Because there may be a way to set/copy session data from one domain to another.

 

but as gizmola states, it will have its drawbacks.

1) Once ppl realize this is what yer site is doing, be prepared for hacking attempts against the script.

 

I really dun see any advantage to this, unless yer using the same userbase across all sites.

 

the thought is to create something like email validators work.

a custom link is given, and information can be retrieved from a central database server. and store the relevant session data here for sites to grab and use.

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.