El usuario se desconecta cuando está en una página con subdominio.

Tengo un User, configurar con Devise.

User can have his own page (with subdomain). Like: awesomeuser.domain.com

On localhost after sign in I can visit both root path and path with subdomain - and he's signed in.

But on production server when he visits path with subdomain - he gets signed out.

Does anyone know what it can be caused by?

Since it works on local machine - I know it's sessions, but what exactly?

Aquí está mi config/initializers/session_store.rb:

MyApp::Application.config.session_store :cookie_store, key: '_MyApp_session', domain: :all

preguntado el 28 de mayo de 14 a las 13:05

1 Respuestas

We had this problem - the issue is your session can only be passed between one domain. The solution is to use domain: :all, however, as you're using subdomain, you have to specify the level of domains the cookies will be valid for, hence tld_length: 2

MyApp::Application.config.session_store :cookie_store, key: '_MyApp_session', domain: :all, tld_length: 2 

We found the answer here: ¿Compartir sesión (cookies) entre subdominios en Rails?

contestado el 23 de mayo de 17 a las 11:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.