help with multiple domains into one app

10 views
Skip to first unread message

tom

unread,
Jan 10, 2019, 4:42:34 PM1/10/19
to Ruby on Rails: Talk
hi,, i have 2 domains setup and i am having issues. 2 domains, layout
is being picked in applciaiton controller.

1st load after deploy shows correct site, but subsequent reloads just
show same site under both domains. here the routes:


class Subdomain1
def self.matches?(request)
request.domain.include?('foo1.com')
end
end
class Subdomain2
def self.matches?(request)
request.domain.include?('foo2.com')
end
end

Rails.application.routes.draw do




#constraints DomainConstraint.new('foo1.com') do
constraints Subdomain1 do
get '/' , :to => 'jobs#landing' , as: 'jobs_landing'
root :to => "jobs#landing", as: 'root_foo1'
end
#constraints DomainConstraint.new('foo2.com') do
constraints Subdomain2 do
get '/' , :to => 'home#front' , as: 'foo2_landing'
root :to => "home#front"
end #


end


#as you can see, i have tried a DomainConstraint, but that resulted in
same behaviour.

any ideas?
Reply all
Reply to author
Forward
0 new messages