[Home] You are not logged in. Login here

Just my stuff

Setting the domain of the session cookie in rails

If you have multiple vhosts like app1.example.com – app2.example.com, but you don’t want your users to log in for every vhost, you can set the session cookie of the rails application for the domain .example.com, so it will be valid for all subdomains of example.com. You can set the ‘session_domain’ option of the ActionController in environment.rb like this:

  config.action_controller.session = {
    :session_domain => 'example.com',
    :session_key => '_myapp',
    :secret      => 'longstringthatyoubetterkeepsecret'
  }

Anonymous Hey said...

Thanks a lot !!

(BTW, cool js effect to deploy the comment form heheh )

Sat Jul 25 17:06:50 +0200 2009
 
Comments for this post have been disabled