My point of view:
- Users change DNS records of their sites to point to the IP address of your server. After that operation, every HTTP request to their domains will be "catched" by your IP address and your application (you should reconfigure your HTTP server, however).
- Every HTTP request contains the
Host
header. That header allows us to make such thing as virtual hosting: many and many hosts can point to only one IP;
- In your application just extract
Host
from the request and query your database for user with such host.
- Flush contents of his page and that's all.
For example, IP of your service is 100.100.100.100, my domain is redsocks.com. I need to change DNS (an A record) of my domain to point to your IP. Supposedly, I did.
When I point my browser to my domain, the browser makes the following request (or similar) to your own IP, not mine:
GET / HTTP/1.1
Host: redsocks.com
...
Your application has the code (pseudocode) that deals with my request:
user = User.find_by_domain(REQUEST["Host"])
if user == nil
render_not_found_page
else
contents = Content.get_contents_of_user(user)
render_contents_of_user contents
end
And I see my very own page within your service on my domain.