Failed to set Rails session cookie

I have a rails application, which is a CMS that uses dynamic subdomains for each site. For some reason, when I deployed to production, the session cookie is not set. I think this leads to "Invalid Authentication Token" errors that occur everywhere.

I have my setup.rb setup so that I can share sessions by subdomain. What could be wrong if the cookie is not set at all?

#production.rb
config.action_controller.session[:domain] = '.domain.com'


#environment.rb
config.action_controller.session = {
   :session_key => '_app_session',
   :secret      => '.... nums and chars .....'
 }
+3
source share
1 answer

Try using the following in your production.rb:

config.action_controller.session = {:domain => '.domain.com'}

0
source

Source: https://habr.com/ru/post/1740201/


All Articles