I have a Rails3 application that uses subdomains. To allow inputs, etc. Work in all subdomains, I do this in config/initializers/session_store.rb
MyApp::Application.config.session_store :cookie_store, :key => '_myapp_session', :domain => :all
When I deploy my application to Heroku, this works fine. I can log in and log in through subdomains.
However, with local development, this does not work.
My browser set the session cookie correctly:
$ curl http://test.lhs.com/users/sign_in ... Set-Cookie: _myapp_session=BAh...3ed; domain=.lhs.com; path=/; HttpOnly ...
However, my browser (I tried Safari, FireFox and Chrome) did not set this cookie. So, when I log in, I get an InvalidAuthenticityToken error.
I tried to remove the :domain => :all that correctly set the session cookie, but only for the current subdomain. If it is explicitly specified like this :domain => '.lhs.com' does not set a cookie either.
I donโt get it here. Why does it work in production on the hero, but not locally. I even tried different servers (Webrick with rails server and individually for passengers). I also tried working locally on port 80 instead of 3000, but that doesn't matter either.
Any hints why the session cookie is not set locally? Thanks!