2

I have a basic subdomain set which is:

lvh.me:3000i
api.lvh.me:3000

mydomain.com
www.mydomain.com
api.mydomain.com

Specifically the api domain needs to be on redis session store. So I am attempting to setup my session store, but it doesn't seem to work.

Rails.application.config.session_store :cookie_store, key: '_my_domain', domain: "mydomain.com"

Rails.application.config.session_store :redis_store, key: '_my_dmoain', domain: "api.mydomain.com", servers: {
    host: REDIS_CONFIG["host"],
    port: REDIS_CONFIG["port"],
    db: REDIS_CONFIG["db"],
    password: REDIS_CONFIG["password"],
  }

How do I setup my session_store.rb file?

nitsujri
  • 1,448
  • 2
  • 16
  • 29

1 Answers1

0

You'll need to use the tld_length switch:

Rails.application.config.session_store :cookie_store, key: '_my_domain', domain: :all, tld_length: 2

Info here: Share session (cookies) between subdomains in Rails?

Community
  • 1
  • 1
Richard Peck
  • 76,116
  • 9
  • 93
  • 147