2
7 Comments

Can someone explain creating a domain parking service and managing DNS?

I want to create a simple domain parking service. At a mimimum I want users to be able to point their site to my parking site (parkedforgood.com). Preferably, I want to allow users to have their own customized version of the page.

I tried to use Vercel's wildcard domain and generated a specific subdomain for each users domain similar to their example. Then users could point their domain to that subdomain and it would show their specific parking page. However, I've been told that's not how it works the DNS wouldn't map from example.com to example.parkedforgood.com.

I've spent a while googling how to create a domain parking service without any real results. From what I gathered I could use Route 53 to automate the process of mapping DNS records, but even that is hard to find any info on.

What is the simplest way to create a simple domain parking service like this?

Edit: I also found this post where a comment explains that Netlify may allow you to do this via an API but I can't find any info on that either:
https://www.indiehackers.com/post/how-do-you-allow-users-to-add-a-custom-domain-ba3fbcc35a, it seems possible Vercel has something similar?

  1. 2

    However, I've been told that's not how it works the DNS wouldn't map from example.com to example.parkedforgood.com.

    The reason this doesn't work is because root domain names have to be an A record (point to an IP address) and not a CNAME (pointing to a subdomain).

    What is the simplest way to create a simple domain parking service like this?

    Your approach has the right idea, you just need a static IP address someone can point their domain name at. Then, when a request comes in to your service, you inspect the Host header, see if it matches a domain registered in your service, and then show the associated page.

    FYI: Adding https to this (if that's your plan) is a whole other animal that makes things far more complicated and will require some customization with whatever load balancer you're using to accept traffic.

    1. 1

      That makes a lot of sense to me, though I don't believe Vercel offers static IPs but I could just switch to something like DigitalOcean. However in the same thread linked above some recommends not using a IPs:

      Do NOT give them an IP for an A record, you will regret it if you ever move server. CNAME gives you update control.

      Which makes a lot of sense too, if I ever had to destroy a droplet/change IP for some reason all parked domains would break right?

      1. 1

        You could just have them point the www CNAME to your domain, then have them redirect the root domain to www. Most registries do this by default anyway.

        I agree with that one quote, I wouldn't have them point to a static IP.

      2. 1

        Yeah it does take a little extra planning, but it’s not (in my opinion at least) the end of the world. And it’s really the only way to do what you want to do.

        if I ever had to destroy a droplet/change IP for some reason all parked domains would break right?

        If you use the dynamic IP assigned directly to the droplet, yes. What you really want is to either use their load balancer product, which looks to give you a static IP that will exist for the life of the load balancer, or allocate what they call a “floating IP” which is a static IP that can be attached to any droplet of your choosing. The floating IP will be yours until you choose to release it.

        1. 1

          Ah I see I misread the docs on DO floating IPs. So what id want to do is get users to point their A records to a DO floating IP mapped to my droplet, which would probably be sufficient for this small side project. Or, setup a load balancing product and use the static IP from that which would probably be better for higher availability (have any service recommendations?). And either way none of this would tackle setting up https, which would be preferable, so that’s something I’ll need to look into.

          Man this escalated quickly for a side project on a whim.

          1. 1

            The Load Balancer on DO offers a way to generate SSL cert automatically using "Lets Encrypt". I do not know whether they offer an API to automatically add domains to the list, nor do I know whether they will allow domains that aren't registered with them. "Lets Encrypt" checks whether the domain points to the right spot but I don't know whether DO added extra verification steps.

            If you do floating IP(s) then you would have to implement your own mechanism to generate the cert, which isn't too difficult either though involves keeping track of expiration date and such.

            As far as scale is concerned. Well with the Load Balancer you can keep adding droplets in the back so that gives you potential for major scale. I don't know how much DO can handle but the day you max that out then you probably will have the means to upgrade your infrastructure anyway ;)

            If you go with the Floating IP then well you are stuck with the one Droplet which you could eventually max out and then you would need another Floating IP which means you would need to change your instructions to your customers based on which Floating IP as capacity.

            The Load Balancer is probably the most flexible approach, but you'd have to do your due diligence if you plan on offering https.

  2. 1

    The problem with Vercel is that they have a single entry point and do the routing based on the Host header of the request (that's how most reverse proxies work).

    So even if you set the example.com to have a CNAME to example.parkedforgood.com, the Host header sent to example.parkedforgood.com will be "example.com", so Vercel needs to know how to route example.com, and that requires adding an extra project in their UI (which would have to be replicated for all clients).

    My suggestion would be to use your own server and load balancer/reverse proxy for this. Otherwise I don't really see how you could pull it off.

Recommended Posts