Nikolas Vourlakis
2013-Nov-15 07:37 UTC
How to share user session to different top level domains belonging to the same rails app?
Hello, I am copying my question on stackoverflow<http://stackoverflow.com/questions/19975656/how-to-share-user-session-to-different-top-level-domains-belonging-to-the-same-r>here. I have a *single rails application* running on *one unicorn server*, where a user can register and create a public profile. This profile is under a subdomain that the user specifies and a top level domain based on the country of the user. For example *user_domain.appname.gr* and *another_user_domain.appname.com.cy* and so on. The ''appname'' part of the url does not change and the tld length based on country is not fixed. The base domain of the application is appname.gr. Through that the user can access functionality like searching for public profiles. He signs in under the appname.*gr* domain and devise is used for user authentication. *Problem:* If he visits another_user_domain.appname.*com.cy* he will appear as non signed in. For *.appname.*gr* everything is ok. How the user session gets shared across all domains of the application? I searched about it but it is not clear to me how to solve this. One thing I suspect is that the session must be stored in the database but what happens with the cookies? When a user visits *.appname.com.cy and he already has a session and a cookie for *.appname.gr, how I know who is the user to get his session? Are there any common practices or gems that solve this problem? Thanks in advance! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a6b9b2c8-3396-4e18-9c06-0c7c77cf5cca%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.