September 13, 2018

How to offer custom domains to my users?

Hello, I have a great doubt. How can I offer my users the possibility of adding a custom domain from my platform? As does Medium or Wordpress, for example.

Does it work reselling domains? Is there any service for that? Any information would be useful to me.

  1. 5

    You can't just worry about DNS. You have to also worry about securing your custom domains with SSL. CloudFlare offers a great solution for that however only on their enterprise plan. A much cheaper solution is I'd recommend checking that out. It makes it really easy.

    1. 2

      Very true, I was overlooking the certificate. Thanks for the recommendation, I will analyze

    2. 1

      Can you explain how to do it with Fly? I currently use a non-secure solution where users assign a CNAME to their arbitrary subdomain, which leads to my product's domain. But I'd want to make this secure. CloudFlare's solution for SaaS is perfect, but it costs a lot of money.

      1. 1

        Here is an example of adding to a Heroku app.

        Once you have done that, you can add custom domains with Fly's hostnames API. Docs are here.

        I'll write an article on how to do it sometime soon. You can follow me on Medium to get notified once I do.

        1. 2

          I figured it out, thanks. It works great! Sweet secure connections for our whitelabel accounts!

  2. 4

    I've built similar functionality for my app.

    Your customer will need to make updates to their DNS records to point a record at your server. You will need to make a change into your webserver config to respond on that domain.

    There are some plugins that you can use for Apache for example that will automate creation of these records, or you can manage it manually, but it won't scale.

    Beware that some platforms / codebases do not actually support serving content from multiple domains, and if they do, you will need to test thoroughly for issues like absolute / hardcoded links in content, everything will need to be changed to relative.

    1. 3

      You will need to make a change into your webserver config to respond on that domain.

      This is not entirely correct. Assuming your have control over your servers vhost files; you can do some wildcard trickery which will remove the need to add a manual entry for every new domain pointed to your service. We do the same with Pagestead.

      1. 1

        Righto, interested to hear what these are.

        There is some risk to this approach though right, you're effectively making your server open to responding as any domain that has it's records pointed to you? I get you could have some control from the app/codebase itself, but still something I would consider deeply.

        1. 1

          As long as your code on the receiving end of the requests does its job; there's nothing to worry about. You're going to want to make sure that your application knows crystal clear which requests to handle and which to ignore.

    2. 1

      thanks for the explanation!

  3. 3

    Our product does exactly this; they way we have happen is that the customer created a DNS record and points it to the server running the software. The server will be configured that, automatically, it forwards the requests to the Pagestead software running on that server. Finally, Pagestead uses some internal routing an logic to map the domain to the customer's website.

    1. 1

      Any chance you could expand on the “internal routing an[d] logic to map the domain to the customer's website” bit?

    2. 1

      Thanks for sharing your implementation. I looked Pagestead, it's awesome!

  4. 3

    Hey Jacob, I found a Quora article that should be helpful:

    CNAME pointed to your domain and then interpreted by your app somehow should do the trick. You could test this easily before jumping into the complexity of reselling.

    Good luck!

    1. 1

      I had searched and I did not find. I think I searched bad, thanks for the link.

      Definitely what you say seems to be better than implementing resale.

  5. 2

    Its probably a roll your own solution. But I did this for one platform for a while. Basically anything coming in on:

    https://* comes to your server.

    Then if it comes in as:

    You connect to a separate database for apple. In the sign up script you just create the separate database for the subdomain.

    Kind of easy really. Though I suppose depending on the service you are running, or the number of users it might not be so.

    1. 1

      A very easy and ingenious solution, I think that for the MVP it could serve, thanks for sharing.

  6. 2
  7. 1

    If you find a solution, let us know. I’m currently researching how to do this as well. Every user has a unique url on my domain, but i want users to be able to use their own domain if they like.