I have an app I am working on using acts_as_tenant and devise. When non-logged in visitors come to the site and click on some protected link they should be sent to http://www.my-app.com/users/sign_in. However, right now a visitor who clicks on some protected link gets redirected to http://my-app.com/users/sign_in which heroku cannot handle.
Here is my devise routes block:
devise_for :users, :controllers => {:sessions => 'users/sessions'} do
get '/users/sign_up' => 'users/sessions#new', :as => :new_user_session
post '/users/sign_in' => 'users/sessions#create', :as => :user_session
get '/users/sign_out' => 'users/sessions#destroy', :as => :destroy_user_session
end
How do I set this to redirect correctly? It seems like this is not a routes issue but I am not sure how to approach this.
Please let me know if I can provide any additional information or should approach asking this question differently.
A couple of things. Are you using SSL because Heroku should handle naked domains for non-ssl websites. If you are using SSL for signed in users, you’ll need to setup devise to use SSL according to How To: Use SSL (HTTPS) · heartcombo/devise Wiki · GitHub. I don’t see that you’re using SSL, is your heroku app available online to view? Is your source code available on github to view?
I am pretty sure I am not using ssl yet. To answer your other questions, yes the heroku app is available to view and my source code is available on github to view. I sent you a separate email with info for both questions.
This turned out to be a dns issue. The naked domain was not set to CNAME to heroku and heroku was not setup to take the naked domain. Once I updated everything this worked as designed.