3
6 Comments

Ask IH - Need help with CNAME

I have built a profile page website. The user is given a profile page like IH, i.e. abc.com/username
I want users to be able to use their own domain/sub-domain.
With all the reading, I could surmise CNAME is the way to go.
The user can set the CNAME and direct it to my domain.
My queries;

  1. What changes do I have to do at my end?
  2. Would my hosting company have an issue with that? I have an unlimited domain plan.
  3. Is there any complete guide from the developers' perspective?
  1. 2

    your approach should basically work but since dns does not know about path names (ie. /username), your app will need to do the following:

    1. have a setting where the user configures the domain he'd like to use (eg. johndoe.com)
    2. inspect via which domain the user accesses your app (in this case johndoe.com -- which is a cname to abc.com)
    3. lookup the user by that domain (johndoe.com is configured for the user at abc.com/johndoe)

    you can also allow multiple external cname domains to point to the same user by letting them configure as many as you'd like in their profile.

    i do the same (though somewhat more complicated) over at bubble.email.

    1. 1

      Thanks for the reply.
      So, I have to use HTTP referrer in my script to identify the domain being used by user. Please correct me if I am wrong. (Step 2 in your reply)
      Is there a guideline for the server side scripting?

      1. 1

        not referer. the host header. the user‘s browser sends the requested domain in the Host header.

        1. 1

          So the subdomain & domain only. Not the URL parameters.
          Thanks =)

  2. 1

    I have this same issue. Were you able to find a guide on how to do this?

    1. 1

      sz's reply was helpful for me to get things moving in the right direction.
      However, dealing with non-tech resellers was tiring. So I opted for the cURL way for that project.
      https://www.indiehackers.com/post/letting-resellers-parse-my-single-page-html-content-seems-like-a-good-idea-do-you-agree-95c35bd5a4

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 47 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 27 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments