3

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 to northwind.example.com and northwind.example.com appears in the url bar.
  • If a user types example.northwind.com, they go to northwind.example.com and example.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?

yaserso
  • 2,638
  • 5
  • 41
  • 73
  • And what is your actual specific question? – arkascha Jun 03 '20 at 13:58
  • I want to know provide the ability to use custom domains for my clients; I want to either know how Intercom does it (or anyone similar), or how to implement it using my technologies (Node, Mongo, and Nginx. – yaserso Jun 03 '20 at 17:25
  • Sorry, but that is all much to vague and broad, nothing that can be answered in the Q&A style here. To learn how "Intercom" operates you will have to ask them and about implementing such thing yourself: I#d say go, get started and take one step after another. Then, if you hit an issue you cannot solve yourself, _then_ is the time to come here, posting your solution so far and asking a _specific_ question. – arkascha Jun 03 '20 at 21:59

1 Answers1

8

I decided to ask Intercom themselves, through their support channel, for an answer, and I was given the following response:

This isn't actually something we do anything too special with, it is all to do with the configuration of the web server, both on our side and the side of the client.

This stackoverflow goes into more details on this, but keep in mind that whilst it is a ruby StackOverflow - it focuses on the web server set up, in this case nginx - but it could be any web server software.

How to preserve request url with nginx proxy_pass

This then allows your service to receive the requests, but also have access to the original server address - we then ask our customers to provide the custom domain they are using within their Article Setting to help us translate the server address to the correct help center.

I do hope this helps, if you do have any follow up questions I'm happy to try and help, but as you mentioned this does fall out of the scope of our team so the help I can provide may be limited.

Quite happy with the response, as they went above and beyond for me. Basically, the path I was on was the correct one. I decided to leave the question to help others. I also found the following related questions:

Good luck to those who find this.

yaserso
  • 2,638
  • 5
  • 41
  • 73