You’re not receiving notifications from this thread.
Share session across multiple Rails micro-services using CookieStore
Has anyone successfully made multiple Rails 6 applications share the same session cookie? I have two applications: login and admin. Login authenticates the user and sets a session cookie after which it redirects the user to admin. Everything is running through Kong Gateway on port 80 like this.
I have made sure credentials.yml.enc and the cookie_store key are the same in both repos. The cookie is also transmitted correctly through Kong, so the problem doesn't seem to be there. However, when the browser hits admin, the session is reset. What am I missing?
As a test I tried the same setup with ActiveRecord session store, which works flawlessly.
I think I have this working properly, but I have had a few random errors occasionally. I think what fixed it is setting the domain to the proper value. Otherwise, each subdomain has its own cooke.
Rails.application.config.session_store :cookie_store, key: "app-name_session", domain: “.thedomain.tld", expire_after: 1.week