5
6 Comments

User Subdomains & Custom Domain in Node

What is the most reliable and scalable way to provide users with their own subdomain on my app and allow them to map their own domain name in Node.js?

I'm presuming using Express vHost (https://github.com/expressjs/vhost) for handling the subdomain?

How can a user then add a DNS record on their domain to map to the subdomain on https://user.myapp.com?

on March 15, 2020
  1. 2

    Hi kyle. So how did you fix this? Did you go with a path based approach as suggested by @nikersfy in the answer? If so how did you pull it off? Or did you setup a wildcard SSL in prod, how much did this cost you?

  2. 2

    Hey Kyle, I use Zeit for hosting my serverless Node functions and their Wildcard domains help me do just this exact thing. See https://zeit.co/docs/v2/custom-domains#wildcard-domains - hopefully this helps!

  3. 2

    This comment was deleted 6 years ago

    1. 1

      A path-based approach would also work, the priority is that the user can use their own domain.

      Can I map a CNAME to a path without much hassle?

      1. 1

        This comment was deleted 6 years ago

  4. 1

    This comment was deleted 6 years ago

    1. 1

      Thanks Thomas. I want them to be able to point their own domain at a landing page on my service. Subdomain is optional, if a path is easier to setup I can run with that. Would it be achievable to set something like this up with Heroku?

      1. 1

        This comment was deleted 5 years ago

        1. 1

          Yes, exactly

          1. 1

            This comment was deleted 5 years ago

            1. 1

              Oh, that sounds simple – do I not need to set anything up on my end other than a subdomain wildcard?

              1. 1

                This comment was deleted 6 years ago

                1. 1

                  This comment was deleted 3 years ago

                  1. 1

                    This comment was deleted 6 years ago

                    1. 1

                      This comment was deleted 6 years ago

                    2. 1

                      This comment was deleted 3 years ago