2

I've followed the ascii cast up at http://asciicasts.com/episodes/221-subdomains-in-rails-3

I've set the :domain option to :all in session store:

Rails.application.config.session_store :cookie_store, :key => '_bloggit_session', :domain => :all

Now my users cannot logout.

Any ideas why? I've tried deleting all cookies and then trying again, etc.

I can login, and my session is carried across subdomains, but I can't logout.

I am using rails 3, and authlogic for authentication.

Thanks for any help!

stringo0
  • 2,720
  • 7
  • 38
  • 52

1 Answers1

1

Specify the Domain.

I had the exact same issue and the culprit was using :domain => :all.

You'd think that would be all you need but it seems to cause some problems so I had to manually specify the domain with a preceding dot (.), like so:

:domain => '.lvh.me'

This fixed the issue in development. You can use different ways to set this in your various environments but I landed on something like this:

Rails.application.config.session_store :cookie_store, 
  :key => '_bloggit_session',
  :domain => { production:  '.bloggit.com',
               staging:     '.bloggitstaging.com',
               development: '.lvh.me' }.fetch(Rails.env.to_sym)
Community
  • 1
  • 1
Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245