0

I'm currently working on an ecommerce platform built with React and Node.js, similar to Shopify. In our platform, we provide subdomains to store owners upon registration (e.g., subdomain.example.com). However, some store owners have expressed the need to use their own custom domains (e.g., example.in) for their stores.

handle DNS configuration to allow store owners to use their custom domains. While I've implemented the logic in the React/Node app, I'm uncertain about the steps required for users to configure their DNS settings.

Specific Questions:

  1. What DNS configurations are necessary for users who want to use their custom domains (example.in) for their stores?
  2. How can I guide store owners to update their DNS settings to point to our platform?
  3. Are there any considerations or best practices I should be aware of when dealing with custom domains in this context?

What I've Tried: I've created a CNAME record from the store owner's account with the following details:

  • Name: example.in
  • Target: subdomain.example.com

Expected Outcome: After the proper DNS configuration, I expect that store owners should be able to access their stores using their custom domains (example.in).

1
  • One problem is that CNAME records won't work with the domain apex. You can't use them for domain.in (although you can use them for www.domain.in.) Dec 5, 2023 at 2:24

1 Answer 1

1

What DNS configurations are necessary for users who want to use their custom domains (example.in) for their stores?

For an apex domain (with no www or other subdomain) your users will need to have an A record pointed at your app's IP address. By DNS spec (and therefore most DNS servers) apex domains cannot be pointed with a CNAME. You can however, point a subdomain at an IP address with an A record.

Subdomains also have the option of pointing a CNAME record at another domain or subdomain. With this method, you could tell your users to point a CNAME for their custom, non-apex domain at their existing subdomain you already provide, or another you already have pointed at your app for this purpose.

How can I guide store owners to update their DNS settings to point to our platform?

While interfaces and wording can differ for each user's DNS provider, generally the easiest thing to do is to tell them to add a single A record pointed at your app's IP address. This will work whether they're using an apex domain or a subdomain, simplifying things.

One thing to note here: using A records to point at the app IP address means that if that IP address ever changes, you'll need to ask your users to each change their DNS record. You could instead force them to use a subdomain and a CNAME to point at some domain or subdomain you own, which would let you change what IP they're all (indirectly) pointed at, at once. But that does mean they have to use a subdomain, so it's a tradeoff.

Are there any considerations or best practices I should be aware of when dealing with custom domains in this context?

You should be considering SSL/TLS encryption for each custom domain. Since they'll be pointing at your app, you'll either need to provision, manage, and renew them yourself (automated or not), or use a reverse proxy service that handles it for you, like Approximated or CloudFlare.

If you choose to automate that yourself, my suggestion is to start with Caddy server. It's not necessarily trivial to build and manage a robust solution for this at scale, but it is do-able if you're willing to invest time and effort. I'd also recommend learning the acme protocol and how certificate authorities work so that you're aware of the nuances and pitfalls involved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.