subdomain-authentication icon indicating copy to clipboard operation
subdomain-authentication copied to clipboard

Session (and logged in user) not maintained across subdomains

Open fortuity opened this issue 15 years ago • 0 comments

If you are having this problem: You log in as a user, and change to some subdomain and you're no longer logged in as the current user, and when your return to the main domain you're still logged in.

To resolve this, and maintain the current user across subdomains, try setting the session domain in environments/production.rb: config.action_controller.session = { :domain => ‘.YOURDOMAIN.COM’ } (note the leading dot on the domain name).

See this blog post for more information: http://garrickvanburen.com/archive/rails-cookie-settings-for-cross-subdomain-sessions

fortuity avatar Sep 07 '10 21:09 fortuity