I want to implement the same functionality Intercom provides to their clients; they allow the implementation of Custom Domains for Articles. I'm not quite sure how they go about their method of implementation, or what they're doing behind the scenes, exactly.
Take the following scenario; a client (company NorthWind), has a subdomain on my company's website (northwind.example.com).
The following is to occur:
- If a user types
northwind.example.com
, they go tonorthwind.example.com
andnorthwind.example.com
appears in the url bar. - If a user types
example.northwind.com
, they go tonorthwind.example.com
andexample.northwind.com
appears in the url bar.
The difference between the way Intercom implements it and the way I wish to implement it is that I'm using a subdomain, not a directory, as seen in Intercom's help article linked above.
Considering my website runs on Nginx, NodeJS, and MongoDB, here's what I came up with so far:
- Client registers a CName record on their domain provider to point to their page on my website.
- Client provides the CName record they used to my website (register it through a form).
- I save a record in MongoDB for the company and their custom domain.
- I register, or re-register, the reverse proxies of my website, using redbird to allow the redirection to go through.
I've already looked into Redirect Web Page to Another Site Without Changing URL and Does a Cname Change the URL that the Browser Displays.
Am I on the right path, or is there a better method?