I have an application in rails and hosted on Heroku. Now , what I want is that the application can be accessed from 2 different domains, when the application is accessed from suppose a.com it should have a specific frontend, and when accessed from b.com it should display some other frontend. The backend should be same for both. To achieve this I suppose there is only one way I guess, which is to have two different application with same backed code, and same database(I am using PostgreSQL). I need some help on how Do I achieve this, if not, then some other alternative.
Asked
Active
Viewed 139 times
1 Answers
0
You could have only one app for both if it's easier for you. I would then suggest you configure config/routes.rb to respond differently according to the domain name.
See another answer about it here: Rails routing to handle multiple domains on single application
And the Advanced Contraints in Rails here: http://guides.rubyonrails.org/routing.html#advanced-constraints

Community
- 1
- 1

mathieugagne
- 2,465
- 1
- 17
- 18
-
Not too familiar with Heroku but I guess what you're saying is that Heroku sets up your DNS for you? And in no way you could point two records to the same IP? That'd be weird. Imagine pointing different alias of your domain to the same app.. Heroku wouldn't allow that?? – mathieugagne Feb 05 '13 at 04:40
-
they have provision for one domain to be added through their interface. – iamsolankiamit Feb 07 '13 at 17:26
-
I doubt that'd be through. Indeed I found this: https://devcenter.heroku.com/articles/custom-domains. You'll be just fine :) – mathieugagne Feb 07 '13 at 18:14
-
through... true. Ouch. That was bad. Grammar Nazi would have ripped me off. – mathieugagne Feb 07 '13 at 21:17