As mentioned in the title, I playing with the tracert and I discovered that and google.com have different IP address but if I copy and paste those IPs in the address bar, I redirect to the homepage of Google. Ok, they are different server but I can't understand why.
I tried with instagram.com and and the result is the same; however if I copy and paste the IPs in the address bar, they don't redirect to the instagram homepage (code 400).
I found something interesting with Instagram: the wwww refers to the z-p42-instagram.c10r.facebook.com instance otherwise the non-www refers to an AWS instance... (Whaaaat?)
Can someone explain this? Thanks in advance
11 Answer
You’re asking three distinct questions.
I discover that and google.com have different ip address but if I copy and paste those IPs in the address bar, I redirect to the homepage of Google. Ok, they are different server but I can't understand why.
and google.com are two different hostnames. They have different A records in DNS and they can have different IP addresses, or multiple IP addresses assigned to them. There is no rule that www and non-www hostnames need to go to the same server or IP. In fact, both could load entirely different websites, or one version may not work at all. It is entirely dependent on how the web servers are configured and how they handle your request AFTER the DNS lookup. In this case, you’ve identified that google uses multiple servers that respond to both requests by redirecting you to the main Google page.
if I copy and paste the IPs in the address bar, they don't redirect to the instagram homepage
This uses an entirely different mechanism. While you are referring to differences in DNS records above. You are referring to differences in the host header of your web request here. All hostnames you type in to your browser are converted to an IP address via DNS. Your web browser actually connects to the IP address every time you make a request. However, the browser also passes along a “host header” that tells the web server you are connecting to what hostname you originally typed in the address bar. This is what makes hosting multiple websites on the same server (same IP) possible. The web server sees the host header and says, “google.com” should display specific content on the web server.
In this case, you are pasting the IP address directly in to the browser. Therefore, all the webserver can go on is the IP address you typed in. This rarely works due to shared hosting of multiple websites on the same server. However, in the case of google the web server is configured to respond with a redirect to google’s homepage if it sees just the IP address, whereas the instagram webserver does not handle just an IP address and instead returns a 404 - Not Found because it is not programmed to recognize that request.
To be technically correct, the host header is replaced with “server name indication” on HTTPS requests, but the functionality is essentially the same.
I found something interesting with Instagram: the wwww refers to the z-p42-instagram.c10r.facebook.com instance otherwise the non-www refers to an AWS instance... (Whaaaat?)
Finally, it appears you are referring to a Reverse DNS lookup of the IP addresses you are using. Converting a hostname to IP address is done by the owner of the domain name using DNS A records. They own the records that convert the hostnames you type in to IP addresses. Alternatively, converting an IP address to a hostname is done by the owner of the IP address using DNS PTR records. They own the records that convert the IP addresses to hostnames.
Converting a hostname to IP and IP back to a hostname are separate and independent processes configured by two different owners of that information. In this case, you’ve found that Instagram decided to point to an IP address of a server that is additionally named by a Facebook hostname. This makes sense as Instagram is owned by Facebook and is likely using the same infrastructure.
2