Reputation: 2639
How could I share session across several subdomains in rails 4 app?
I have tried to set session config as:
Application.config.session_store :cookie_store, key: '_a_session', domain: :all
But it doesn't seem to work
Upvotes: 2
Views: 847
Reputation: 2042
In addition to domain: :all
also add tld_length: 2
.
Full line:
Application.config.session_store :cookie_store, key: '_a_session', domain: :all, tld_length: 2
This correctly creates cookies with an all-domain .domain.com
, whereas with only domain: :all
I found the cookie domain was .subdomain.domain.com
, which is why it wasn't working.
Upvotes: 2