Reputation: 1
I have a rails app with a page at http://mydomain.com/hello.
I would also like to have it mirrored at http://a.usersdomain.com, so that this URL is showing the same app, database, etc.
What I am imagining would be similar to how Tumblr allows you to host a blog at title.tumblr.com and usersdomain.com. Is this possible with a rails app?
Upvotes: 0
Views: 121
Reputation: 1980
You can pretty easily allow users to set up a subdomain on your domain. Just set up a wildcard subdomain with your DNS provider and you can have the rails app do the rest no problem.
So anything.myurl.com
will go to your rails app. You can then have a method to get the subdomain and identify the user/site or whatever.
The users having their own domain redirect to the subdomain given can be done as Jason has mentioned in his answer.
Upvotes: 1
Reputation: 1519
You can use a A entry on your DNS management center for the domain. You would point subdomain of a
to the IP address of the server that is hosting your rails app. If you do not have a static IP address (like Heroku by default) you can use a CNAME entry and point he subdomain on a
to the item listed in the Domains area of the Heroku settings or directly to the current URL like tumblr would. For example on Heroku:
subdomain: a
=> myapp.herokuapp.com
or tumblr/other hosted url
subdomain a
on your domain => title.tumblr.com
or your example:
subdomain a
on usersdomain.com
=> mydomain.com
Hope this helps!
Upvotes: 0