Subdomain Session Not Working in Rails 2.3 and Rails 3 on Heroku with/without a Custom Domain?

后端 未结 2 891
孤城傲影
孤城傲影 2021-01-06 05:55

So I have two heroku apps:

  • http://production-app.com (mapped from http://production-app.heroku.com)
  • http://development-app.heroku.com

O

相关标签:
2条回答
  • 2021-01-06 06:32

    On development-app.heroku.com, I also have those custom subdomains, but since I don't have a custom domain, I just use the wildcard addon.

    Is this addon still available for using custom subdomains like api.mydevdomain.herokuapp.com ?

    0 讨论(0)
  • 2021-01-06 06:46

    In your config/initializers/session_store.rb, tell rails to set the cookie across all domains:

    Rails.application.config.session_store :cookie_store, :key => '_yourapp_session', :domain=>:all
    

    Same as this SO question

    If you are wanting to persist your session between "development-app.heroku.com" and "production-app.com" that cannot be done unless those are the same codebase. If they are the same codebase, then use a before_filter on your application controller to redirect to production-app.com

    0 讨论(0)
提交回复
热议问题