Reputation: 16316
We have a landing site on Heroku with a user signup form. In the DNS, the apex points to www.
, which points to Heroku.
We'd like to put up a beta site, using the beta
subdomain. For now the beta site should be separate from the main site, but they should use the same database, as we'd like to merge the beta site into the main site once it's out of beta.
For example, asana.com points to their info site, while app.asana.com points to the app.
Is there a way to tell which subdomain a request came from and redirect accordingly, or a way to manage and eventually merge two apps on Heroku? Is this something that requires two apps?
Upvotes: 0
Views: 202
Reputation: 32629
You do not need two separate applications for this.
Take a look at Request-Based Constraints from the Rails Routing guide.
Basically, you would have something like this :
root "launch#index", :constraints => {:subdomain => "www"}
constraints :subdomain => "beta" do
# All your app's routes
end
Upvotes: 1