Skip to content

How To: Use subdomains

mynameisrufus edited this page Jun 4, 2012 · 4 revisions

If you are using subdomains and Devise you may encounter this problem in internet explorer:

Started GET "/" for 127.0.0.1 at 2012-05-30 19:18:51 +1000
Processing by Users::DashboardController#home as HTML
Completed 401 Unauthorized in 1ms

You need to configure config/initializers/session_store.rb to share accross subdomains, for example:

WeddingInvitor::Application.config.session_store :cookie_store, key: 'wedvite_session', domain: '.example.com'

To configure per environment you could use the following:

WeddingInvitor::Application.config.session_store :cookie_store, key: 'wedvite_session', domain: {
  production: '.example.com'
  development: '.example.dev'
}.fetch(Rails.env.to_sym, :all)
Clone this wiki locally