Rails 3.2.8 - Share Devise Sessions Across Subdomains with POW

纵饮孤独 提交于 2019-12-01 03:35:39

问题


I am trying to set up a simple subdomain-based blog in rails 3.2.8. Basically it will have sites, users (authenticated through Devise), and memberships to connect users to sites. I set up POW so that myapp.dev is working properly. Each site has a subdomain and I can navigate to the site#show action using the subdomains with no problems. My issue is that I can't get the Devise sessions to be shared across subdomains. Everything is working fine on my heroku app, but I would like to be able to test this locally.

When I add the following to session_store.rb, teh sessions seem to work across subdomains, but then I can't log out.

Appname::Application.config.session_store :cookie_store, :key => '_appname_session', domain: :all

When I change the end to domain: ".appname.dev" it doesn't work.

Any help would be greatly appreciated!


回答1:


Make sure you clear your cookies and restart the app.

Appname::Application.config.session_store :cookie_store, :key => '_appname_session', domain: ".appname.dev"

domain: ".appname.dev" is the correct format for the domain option. The beginning period is important.



来源:https://stackoverflow.com/questions/12092893/rails-3-2-8-share-devise-sessions-across-subdomains-with-pow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!