I'm trying to learn more about networks and came across the following:
When I use dig
to get the IP address of stack overflow, I get the following result:
dig stackoverflow.com +short
151.101.1.69
151.101.193.69
151.101.129.69
151.101.65.69
However, copying any of these IP addresses in my browser returns:
Fastly error: unknown domain: 151.101.65.69. Please check that this domain has been added to a service.
What am I getting wrong here? Why can't I access these IP addresses through my browser?
Many server IP addresses today are configured to serve different websites depending on the Host header that is sent by the browser in the address bar. This is known as virtual hosting. Fastly is one such provider that uses those IP addresses as part of it's content delivery network. But if you enter them directly into your browser the servers will have no idea what website you are trying to access.
You can observe this behavior with curl:
curl -I 151.101.65.69 # This will give an error
curl -I -H "Host: stackoverflow.com" 151.101.65.69 # Specifying the host redirects to the correct website