Devise not working well with multiple subdomains on RoR3 application

前端 未结 2 1333
遇见更好的自我
遇见更好的自我 2021-02-08 19:02

I have seen a lot of questions about this topic, but a lot of them have contradictory information, and for some reason it didnt work for me.

I have:

2条回答
  •  你的背包
    2021-02-08 19:32

    I think the issue is that :all adds a . to the subdomain.lvh.me so you would stay logged in with foo.subdomain.lvh.me which doesn't do you much good.

    :all seems to work if your original login is from the root domain lvh.me and you then redirect to a subdomain. but you can't log in through a subdomain with it set that way.

    MyApplication::Application.config.session_store :cookie_store, :key => '_mykey', :domain => '.lvh.me'
    

    looks like the correct way to specify this.

    Note:

    • Make sure you restart rails after making change.
    • Make sure you clear cookies out for your domain before testing again. You can leave remnant cookies behind that are confusing between tests.

提交回复
热议问题