My custom domain works with GitHub Pages but I would like to understand how it actually works.
For this example I am not using my custom domain at all. My GitHub Pages repository does not contain a CNAME file.
E.g. Given a GitHub Pages repository without a
DNS request for
example.github.io resolves to
ping command for
example.github.io also returns the same IP address:
When I open the website
http://example.github.io in the browser, the browser show the contents of the actual website.
When I type an IP address
22.214.171.124 instead or make an HTTP GET request with a tool like Postman, all I see is a GitHub Pages 404 error.
Why can't I access my GitHub User page by an IP address directly? I thought that browsers replace hostname part of the URL with the IP address response of a DNS lookup, prior to making an HTTP request.