On my local machine, when I authenticate at http://subdomain.myapp.dev (using the Pow server), I am properly redirected to the index page.
When logging into the production domain http://subdomain.myapp.com (hosted on Heroku), I am also able to properly authenticate; however, Heroku is not redirecting to the index page. After submitting the necessary credentials, I receive the 'Signed in successfully' notification but remain on the sign in page.
rake routes and heroku run rake routes return identical routing schemes. I've also listed the contents of my routes.rb file below
Example::Application.routes.draw do
devise_scope :user do
authenticated :user do
root :to => 'admin/servers#index'
end
unauthenticated :user do
root :to => 'devise/sessions#new'
end
end
resources :server_imports
resources :servers
devise_for :users
ActiveAdmin.routes(self)
end
Below are the logs after entering the credentials for signing in:
2013-10-12T01:59:32.110046+00:00 app[web.1]: Started POST "/users/sign_in"
2013-10-12T01:59:32.529842+00:00 app[web.1]: Started GET "/"
And here is the first line from heroku run rake routes
root GET / admin/servers#index
As mentioned above, I still get re-routed to the sign in page after successful authentication. I am confused why this problem is only experienced on Heroku and not on my local machine
Why not do something like this:
def after_sign_in_path_for(resource)
admin_servers_index_path
end
See: https://github.com/plataformatec/devise/wiki/How-To%3A-Redirect-to-a-specific-page-on-successful-sign-in-and-sign-out
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With