Я использую Rails Admin с Devise в моем приложении. Это приложение находится на поддомене (app.site.com).
В среде разработки вход в Rails Admin работает хорошо, но в производственной среде, когда я пытаюсь войти (после входа в систему), я перенаправлен на мою домашнюю страницу, и вход не происходит.
rails_admin.rb
RailsAdmin.config do |config|
config.main_app_name = ["App Name", "Backoffice"]
config.authenticate_with do
warden.authenticate! scope: :admin
end
config.current_user_method(&:current_admin)
end
routes.rb
require 'sidekiq/web'
Rails.application.routes.draw do
devise_for :admins, :controllers => { :sessions => 'admin/sessions', :passwords => 'admin/passwords' }
mount RailsAdmin::Engine => 'admin', as: 'rails_admin'
end
production.log
I, [2018-11-13T19:20:09.853115 #22050] INFO -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] Started POST "/admins/sign_in" for 189.5.44.203 at 2018-11-13 19:20:09 -0200
I, [2018-11-13T19:20:09.854156 #22050] INFO -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] Processing by Admin::SessionsController#create as HTML
I, [2018-11-13T19:20:09.854249 #22050] INFO -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] Parameters: {"utf8"=>"✓", "authenticity_token"=>"rBlkn39HWWPhIgKEDZtHIxeCgvw2vxu8KBGjbO+W2tjidD3c+a6g04G6tJXURDgoZw+CbDbMTZWugXGhaGewjA==", "admin"=>{"email"=>"web@atua.ag", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Login"}
W, [2018-11-13T19:20:09.855012 #22050] WARN -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] HTTP Origin header (https://eventos.facens.br) didn't match request.base_url (http://eventos.facens.br)
D, [2018-11-13T19:20:09.856962 #22050] DEBUG -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] Event Load (0.5ms) SELECT "events".* FROM "events" WHERE "events"."is_featured" = $1 AND (event_start > '2018-11-13') ORDER BY "events"."id" DESC LIMIT $2 [["is_featured", true], ["LIMIT", 1]]
D, [2018-11-13T19:20:09.857900 #22050] DEBUG -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] ConfigSite Load (0.3ms) SELECT "config_sites".* FROM "config_sites" ORDER BY "config_sites"."id" DESC LIMIT $1 [["LIMIT", 1]]
D, [2018-11-13T19:20:09.859423 #22050] DEBUG -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] Admin Load (0.4ms) SELECT "admins".* FROM "admins" WHERE "admins"."email" = $1 ORDER BY "admins"."id" ASC LIMIT $2[["email", "web@atua.ag"], ["LIMIT", 1]]
D, [2018-11-13T19:20:09.971632 #22050] DEBUG -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] (0.3ms) BEGIN
D, [2018-11-13T19:20:09.974645 #22050] DEBUG -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] Admin Update (0.6ms) UPDATE "admins" SET "current_sign_in_at" = $1, "last_sign_in_at" = $2, "last_sign_in_ip" = $3, "sign_in_count" = $4, "updated_at" = $5 WHERE "admins"."id" = $6 [["current_sign_in_at", "2018-11-13 21:20:09.970556"], ["last_sign_in_at", "2018-11-13 21:19:44.092713"], ["last_sign_in_ip", "189.5.44.203"], ["sign_in_count", 9], ["updated_at", "2018-11-13 21:20:09.972299"], ["id", 1]]
D, [2018-11-13T19:20:09.979743 #22050] DEBUG -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] (4.3ms) COMMIT
I, [2018-11-13T19:20:09.981750 #22050] INFO -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] Redirected to http://eventos.facens.br/
I, [2018-11-13T19:20:09.982042 #22050] INFO -- : [d3f1ce41-3c11-4a53-896f-a5ef4cdea7d0] Completed 302 Found in 128ms (ActiveRecord: 6.3ms)
I, [2018-11-13T19:20:10.337732 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Started GET "/" for 189.5.44.203 at 2018-11-13 19:20:10 -0200
I, [2018-11-13T19:20:10.338570 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Processing by HomeController#index as HTML
D, [2018-11-13T19:20:10.340691 #22050] DEBUG -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Event Load (0.5ms) SELECT "events".* FROM "events" WHERE "events"."is_featured" = $1 AND (event_start > '2018-11-13') ORDER BY "events"."id" DESC LIMIT $2 [["is_featured", true], ["LIMIT", 1]]
D, [2018-11-13T19:20:10.341635 #22050] DEBUG -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] ConfigSite Load (0.3ms) SELECT "config_sites".* FROM "config_sites" ORDER BY "config_sites"."id" DESC LIMIT $1 [["LIMIT", 1]]
I, [2018-11-13T19:20:10.343036 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendering home/index.html.erb within layouts/application
I, [2018-11-13T19:20:10.343457 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered shared/_hero.html.erb (0.1ms)
I, [2018-11-13T19:20:10.344713 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered shared/_filter_form.html.erb (0.9ms)
I, [2018-11-13T19:20:10.344846 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered shared/_search.html.erb (1.2ms)
D, [2018-11-13T19:20:10.347126 #22050] DEBUG -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Event Load (1.8ms) SELECT "events".* FROM "events" WHERE (event_start > '2018-11-13') ORDER BY event_start ASC LIMIT $1 [["LIMIT", 8]]
I, [2018-11-13T19:20:10.352858 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered shared/_upcoming.html.erb (7.8ms)
I, [2018-11-13T19:20:10.353993 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered shared/_newsletter.html.erb (0.9ms)
I, [2018-11-13T19:20:10.354217 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered shared/_app.html.erb (0.0ms)
D, [2018-11-13T19:20:10.359666 #22050] DEBUG -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Faq Load (4.9ms) SELECT "faqs".* FROM "faqs" ORDER BY question ASC LIMIT $1 [["LIMIT", 6]]
I, [2018-11-13T19:20:10.360394 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered shared/_faq.html.erb (6.0ms)
I, [2018-11-13T19:20:10.360524 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered home/index.html.erb within layouts/application (17.4ms)
I, [2018-11-13T19:20:10.363120 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered layouts/_header.html.erb (1.5ms)
I, [2018-11-13T19:20:10.364411 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered shared/_contact_form.html.erb (1.0ms)
I, [2018-11-13T19:20:10.364676 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Rendered layouts/_footer.html.erb (1.3ms)
I, [2018-11-13T19:20:10.365098 #22050] INFO -- : [6d62d29b-c18f-4197-96e7-19ff116f7a3e] Completed 200 OK in 26ms (Views: 15.5ms | ActiveRecord: 7.4ms)
Что может происходить? Это имеет отношение к поддомену?
Спасибо.