简体   繁体   中英

How to make own domain point to specific profile on my app

I currently give the ability for my users to have a subdomain for their account so:

subdomain.myaddress.com

will point to the users profile. I want to be able to give the user the ability to point their own domains as well so that both will work and point to the user profile.

How to do that?

Also, if you happen to know about Heroku. There is a plugin to enable custom domains but I have to call: heroku domains:add *.yourdomain.com (or use GUI)

Is there a way to make my app call that command instead?

You can use DNS CNAME records to alias one domain name to another. There are restrictions: you can't use a CNAME on a top-level domain (subdomains only). I don't know about automating it, but CNAME's are commonly used on heroku .

Your application will need to listen to whatever domain the user enters, therefore you would have to use the heroku gem inside your application to add the custom domain the user enters to your application.

Using subdomains is obviously the simpler option here as you can just have the wildcard domain setup on your domain *.mydomain.com and let the choose whatever subdomain they want and then have your application work out the account to use from the subdomain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM