简体   繁体   English

Rails app中的Heroku路由错误

[英]Heroku routing errors in Rails app

On my local machine, when I authenticate at http://subdomain.myapp.dev (using the Pow server), I am properly redirected to the index page. 在我的本地计算机上,当我在http://subdomain.myapp.dev (使用Pow服务器)进行身份验证时,我被正确地重定向到索引页面。

When logging into the production domain http://subdomain.myapp.com (hosted on Heroku), I am also able to properly authenticate; 登录到生产域http://subdomain.myapp.com (在Heroku上托管)时,我也能够正确地进行身份验证; however, Heroku is not redirecting to the index page. 但是,Heroku没有重定向到索引页面。 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. rake routesheroku run rake routes返回相同的路由方案。 I've also listed the contents of my routes.rb file below 我还列出了下面的routes.rb文件的内容

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 这是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 我很困惑为什么这个问题只在Heroku上体验而不在我的本地机器上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM