I have a 2.2.3 app which I upgraded to 2.3.2
It\'s a multi-site (using subdomain) that creates one top level session for all sites.
This is how I change the
A more bullet proof solution would be to check if the session already exists or not. If you are blindly replacing the whole session object it may trip you up in the future.
if ActionController::Base.session
ActionController::Base.session[:domain] = '.example.com'
else
ActionController::Base.session = { :domain => '.example.com' }
end
I like to do this in an initializer file.
we had the same problem (losing sessions, without subdomain), with nginx + thin. Migrating to apache + passenger (last version) fixed the problem.
It could be added in the same place where you set the session key and secret
config.action_controller.session = {
:key => '_app_session',
:domain => '.domain.com',
:secret => 'secret'
}
In Rails 2.3 you should use
config.action_controller.session[:domain] = '.example.com'
You must indicate:
.example.com
(notice the leading dot) in order for the session cookie to apply to example.com as well as its sub-domains.
I had the same problem with cookie-based sessions. Upgrading to Passenger 2.1.3 seemed to fix the issue.