Check Website by IP: the Host Header Picks the Site

Checking a website by IP sounds like one question, and it is really two. The address gets your request to the machine. Which site on that machine answers is decided one layer later, by the Host header in the request itself.

We pointed seven different Host headers at one shared address on 23 October and got seven different answers: a live page, a redirect placeholder, two 301 redirects and three identical 404 pages. The same address also returned a valid certificate for a site that did not exist. A dedicated edge next door answered its own domain with a redirect, its bare address with 403, and a foreign name with 409.

Type an address and a domain to check whether the two belong together, and get the exact request recipe.

The address opens the door. The Host header picks the site.

measured

Pairing bench

Two public resolvers are asked where the domain lives, and the answer is matched against your address.

The bench asks two public resolvers for A records and matches them to your address. Nothing you type is stored or sent anywhere else.

1. The address is only half of the addressing

A URL is read in stages. DNS turns the name into an address, the TCP handshake carries the request to that machine, and only then does the HTTP request land on the server, carrying the Host header it saved from the original URL. On a machine that serves one site this is invisible. On shared hosting the last step is the whole game, and our test address made that plain: seven Host headers, seven answers.

The address is only half of the addressing
Host header sent to 185.199.108.153AnswerWhat came back
facebook.github.io200a real page
jquery.github.io200a 374-byte placeholder that redirects onward
rust-lang.github.io301to the https spelling of itself
barryclark.github.io301to a different domain, www.barryclark.co
twbs.github.io404Site not found
185.199.108.153404the same Site not found page
nonexist-zzz-42.github.io404the same Site not found page again

The two 200 answers are not twins. Facebook's organization page is a document; the jQuery page is a 374-byte note that tells the browser to move along to github.com/jquery. Both are real answers from real sites living behind one shared address. The two 301 answers split differently: one upgrades to https, the other hands the visitor to a domain that no longer shares the address. A server can send a visitor anywhere once it knows which site was asked for, and the Host header is what told it.

2. Three names, one ghost page

The last three rows answered identically, and the reason sits in DNS rather than HTTP. The operator of github.io points every one-level name under the domain at the same four addresses, so twbs.github.io, a made-up name, and the bare address itself all resolve, and the server answers all three with the same Site not found page. The lookup succeeds and the site does not exist.

Two details of the Host header came out of the same run. Capital letters did not matter: JQUERY.GITHUB.IO and jquery.github.io got the same page, because Host names are matched without case. A port suffix did not matter either: jquery.github.io:80 was trimmed back to jquery.github.io before the match. The one thing that mattered was which site was named. That is the layer a website check by IP has to reach, and no DNS query reaches it.

This is also the honest limit of the pairing bench below. It asks two public resolvers where a domain lives, and a yes answer means the address and the domain are joined in DNS. It cannot see whether a page still lives behind the join. The first sample button is that exact trap: DNS pairs the name with the address, and the server has already answered 404 for it in our runs.

3. HTTPS hides the Host header inside SNI

An encrypted connection cannot wait until after the handshake to say which site it wants, because the certificate must be chosen first. So the client names the site in the TLS ClientHello, in the server name indication field. The bench tried four spellings against the same shared address.

HTTPS hides the Host header inside SNI
TLS server name sentCertificate checkHTTP answer
jquery.github.iopassed200
twbs.github.iopassed404 Site not found
none, connected by IPfailed, altname mismatch404
deep.wrong.example.comfailed, altname mismatch200

Two failures with nothing in common. Connecting by bare IP puts no name in the TLS slot, and RFC 6066 forbids putting an address there, so the edge hands back its default certificate for *.github.io, which does not match a number, and the browser stops with ERR_TLS_CERT_ALTNAME_INVALID. The fourth row sent a name the server has no certificate for, got the same default certificate, and failed the same check, yet the server still routed the request by the Host header to the jQuery site and answered 200. The certificate layer and the routing layer never spoke.

The second row is the quiet one. The handshake for twbs.github.io passed validation, because the wildcard certificate covers every one-level name under github.io, and the site behind it answered 404. A passed certificate check means the name fits the pattern on the certificate. It says nothing about whether anything lives there.

4. What a strict edge does with a wrong Host

The GitHub Pages edge tolerates anything and answers with pages. A commercial edge behaves differently. We repeated the exercise against a dedicated Shopify address, 23.227.38.33, which fronts the shopify.com domain, and three Host headers produced three refusals in three registers.

What a strict edge does with a wrong Host
Host header sent to 23.227.38.33AnswerReading
shopify.com301to www.shopify.com, the spelling the edge prefers
23.227.38.33403a bare address arriving nameless, refused
jquery.github.io409a name that belongs to nobody here, conflict

The correct name is redirected to the canonical spelling, the bare address is refused outright, and a foreign name gets a 409 conflict, a status code most people never see served for a Host mismatch. Same pattern as the shared address, stricter temper: the edge routes by Host header and punishes anything it cannot route.

One more reason this layer matters here. When a request goes through an HTTP proxy, the Host header travels inside the proxied request exactly as it travels on the open network, so checking a website by IP through a plain HTTP proxy still announces which site you are asking for. Encryption changes the spelling of that announcement, not the fact of it. The pairing bench below hands you the two-line recipe that names the site explicitly, so what you measure is what the server routes.

Frequently asked questions

What does the Host header do in a request?

It names the site you want after the connection has already been made. DNS and the TCP handshake only carry your client to the machine, and on a shared address seven Host headers produced seven different answers: a live page, a redirect placeholder, two 301 redirects and three identical 404 pages. The address gets you to the door and the Host header picks who answers.

Why does HTTPS to a bare IP address fail with a certificate error?

Because TLS needs a server name to pick a certificate, and RFC 6066 forbids putting an IP address in that slot. The edge returned its default certificate for *.github.io, which does not match the numeric address the browser asked for, so validation failed with ERR_TLS_CERT_ALTNAME_INVALID even though the server was reachable and answered.

Does a valid certificate prove the site exists?

No. The wildcard certificate *.github.io covers every one-level name under github.io, so the handshake for twbs.github.io passed validation while the same site answered 404 Site not found. Certificate validation checks that the name fits the pattern on the certificate, not that anything lives behind it.

Can one lookup list every website that shares an IP address?

No. DNS does not store the list of co-hosted sites anywhere, and the shared address in the test answered seven Host headers in seven different ways, including three sites that do not exist. The only reliable way to address one site on a shared machine is to connect by IP and name the site in the Host header or the TLS server name yourself.