0

I have a Node.js React application that outputs different information fetched from an external API depending on the domain provided in the request as a variable.

I'm looking to point hundreds of domains to the application, and need to extract the root domain (that was used to access the app) to then use in the API request.

How can I do this at scale, considering I'll have many domains and can't be editing a vhost file every time?

DNS: domain1.com CNAME domains.example.com    
App: Vistor goes to "https://domain1.com/example" -> *var domain = "domain1.com"* -> Customized page output
jetlag
  • 3
  • 2

1 Answers1

0

I don't know if you're using Express or not, but this answer might point you in the right direction. Your server should be able to look at the Host header on the request. I think all HTTP requests must include a Host header (documentation), but the way it's exposed in your app may vary from server to server.

Jim J
  • 546
  • 3
  • 11