Score:0

How do sites like workpress.com assign all users their own subdomain?

td flag

How does workdpress.com achieve this, where everyone, get a subdomain, like chooseName.wordpress.com after a new user sign up and when the subdomain has not been chosen?

Keith Langmead avatar
us flag
What is your question as the title and content seem to be asking different questions? Based on the title, this may answer your question https://serverfault.com/questions/652237/whats-the-maximum-number-of-ips-a-dns-a-record-can-have
Score:2
za flag

I believe they have a wildcard CNAME record:

*.wordpress.com. CNAME lb.wordpress.com.

So any query to the name which doesn't exists explicitly gets answered with this CNAME record.

This seems plausible because you can just generate random valid DNS name ending with wordpress.com, which is unlikely to be taken by anyone, and yet the DNS answers with this CNAME. So (almost) all hostnames like *.wordpress.com were set pointing to the lb.wordpress.com a priori, and they work at the DNS level even when not claimed.

How do they process it is another question. Basically, the web servers behind lb.wordpress.com just use the Host header as additional input parameter. After someone claims some name, it is added to some database table which gets queried with this parameter.

user294265 avatar
td flag
can you provide more detail on how to achieve that ? maybe some keywords for google search or some guides to read on?
Nikita Kipriyanov avatar
za flag
What "this"? DNS? Just create such a record and it will work. How to write such a web application? First learn how to write a decent *ordinary* web application without these fancy tricks, and while you'll be learning it, the answer will eventually become apparent once you gain enough knowledge on various diverse subjects. Otherwise the question is too broad to be answered here and I believe such a "how to" could not exist, and even it does it must be hopelessly useless (too generic or too long). Also, learning material recommendations are off topic on ServerFault.
Nikita Kipriyanov avatar
za flag
The key idea (what's different in comparison to "ordinary" web application) I already mentioned: you have to use the `Host` header as an additional parameter in an application.
Score:2
in flag

Too long for a comment, but indeed as already answered (please vote up)

1. a wildcard DNS *.wordpress.com. record so that you don't need to actually create a new DNS record, a new subdomain, for each new subscriber.

2. A similar pre-installed wildcard SSL certificate valid for *.wordpress.com. so that all potential subdomains automatically already have TLS support and there is no need to generate and install a new SSL certificate for each new subscriber either.

3. A web site / web application that is designed for multi tenancy. For each new subscriber only a new profile gets created and their "own" customised WordPress site becomes active immediately, without having to install, deploy, configure and customise a copy (or an instance) of the (stand alone) web application.

This leverages the fact that for HTTP/HTTPS the web browser must send a Host: header with each request containing the DNS hostname of the website the visitor wants to visit. That allows the server back-end to select if a subscriber using that subdomain exists and then show the pages for that particular WordPress site.

When visiting a subdomain which hasn't been claimed yet by a subscriber, the server backend will typically take you to a sign-up page.

(For background see the name based virtual hosting and for TLS the Server Name Indication wikipedia articles.)

Nikita Kipriyanov avatar
za flag
This answer has much more clarity than mine, thanks!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.