3

Issuing the following commands returns the displayed results:

$ ping -c 4 freebsd.stackexchange.com

Pinging freebsd.stackexchange.com [151.101.129.69] with 32 bytes of data:
Reply from 151.101.129.69: bytes=32 time=15ms TTL=56
Reply from 151.101.129.69: bytes=32 time=15ms TTL=56
Reply from 151.101.129.69: bytes=32 time=15ms TTL=56
Reply from 151.101.129.69: bytes=32 time=15ms TTL=56

Ping statistics for 151.101.129.69:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 15ms, Maximum = 15ms, Average = 15ms

$ curl -X HEAD -I https://freebsd.stackexchange.com
HTTP/2 404
x-request-guid: 91d4d75c-cf9c-45dc-aea0-a5ffdb1061b7
accept-ranges: bytes
date: Mon, 23 Dec 2019 14:55:35 GMT
via: 1.1 varnish
x-served-by: cache-mad22044-MAD
x-cache: MISS
x-cache-hits: 0
x-timer: S1577112935.892355,VS0,VE110
vary: Fastly-SSL
x-dns-prefetch-control: off
set-cookie: prov=f1b9e1bc-4bf3-d056-52fe-6c343fdd9f7e; domain=.stackexchange.com; expires=Fri, 01-Jan-2055 00:00:00 GMT; path=/; HttpOnly
content-length: 3850

When I try to open the the link in a browser a page is displayed with the following message:

Couldn't find freebsd.stackexchange.com
The Q&A site freebsd.stackexchange.com doesn't seem to exist…yet
...

How can that be?

| |
  • @terdon I am trying to understand why the domain exists but the site does not. – Paulo Tomé Dec 23 '19 at 16:03
  • Yeah, sorry, I figured it out eventually. – terdon Dec 23 '19 at 16:05
  • 3
    the *.stackexchange.com are virtual hosts, which are usually implemented with wildcard dns records (the reason for those results), the required Host: header of HTTP/1.1, the server name indication of TLS, and wildcard public key certificates. – mosvy Dec 25 '19 at 7:26
  • 2
    subdomains do not need to resolve to the same IP, and most of the time they don't (eg. mail.google.com will not resolve to the same IP as maps.google.com). – mosvy Dec 25 '19 at 7:34
10

The foo.stackexchange.com names are subdomains, they all go to the same actual IP. For example:

$ for i in unix ubuntu apple workplace english french; do ping -c 1 $i.stackexchange.com | grep PING; done
PING unix.stackexchange.com (151.101.65.69) 56(84) bytes of data.
PING ubuntu.stackexchange.com (151.101.65.69) 56(84) bytes of data.
PING apple.stackexchange.com (151.101.65.69) 56(84) bytes of data.
PING workplace.stackexchange.com (151.101.193.69) 56(84) bytes of data.
PING english.stackexchange.com (151.101.129.69) 56(84) bytes of data.
PING french.stackexchange.com (151.101.65.69) 56(84) bytes of data.

You get the exact same response no matter what you put in front of the stackexchange.com:

$ for i in snotty snooty smelly grimy; do ping -c 1 $i.stackexchange.com | grep PING; done
PING snotty.stackexchange.com (151.101.193.69) 56(84) bytes of data.
PING snooty.stackexchange.com (151.101.193.69) 56(84) bytes of data.
PING smelly.stackexchange.com (151.101.1.69) 56(84) bytes of data.
PING grimy.stackexchange.com (151.101.1.69) 56(84) bytes of data.

There is no FreeBSD site on the stackexchange network, so you can't actually visit any site using the freebsd.stackexchange.com. Instead, you are taken to a landing page on the stackexchange.com parent domain:

enter image description here

This is a very common pattern. Most hosting providers, if not all, will give you multiple (even unlimited for higher end plans) foo.yoursite.com subdomains.

| |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .