0

I'm trying to build an app that generates individual websites.

The idea is for the owner to register his domain, tell it to my platform, point it to my amazon server (still not sure how too).

Then on my express.js server I serve content based on the domain the request is coming from.

coiso
  • 7,151
  • 12
  • 44
  • 63

1 Answers1

0

You can get the requested hostname from the headers from a field called 'host'. For a node http.ServerRequest, it's available at request.headers.host. For an express app, it can be accessed from req.get('host'). With the hostname, you can route calls from different hostnames to different responses.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23

Michael Tang
  • 4,686
  • 5
  • 25
  • 24