-3

For my target domain e.g. www.domain.com I find the ip address with ping command but if I browse directly the ip address I obtain an error page. How is it possible? I know that problably the service is deployed in Virtual Private Server but I do not understand how the two things are exactly correlated.

ISMSDEV
  • 3,272
  • 12
  • 22
Bob
  • 129
  • 2
  • 7
  • 1
    I think you should check how HTTP protocol deals with this: https://serverfault.com/questions/106882/how-do-you-have-one-ip-address-and-many-websites – gonczor Oct 18 '17 at 14:09
  • 3
    I'm not sure that this is a security question. – Anders Oct 18 '17 at 14:12
  • 2
    You might want to read up on how hostnames work and IP addresses work within the context of a web server. – ISMSDEV Oct 18 '17 at 14:15

3 Answers3

1

Your hoster uses a thing called "Server Name Indication". That means http requests may contain the hostname of the webpage you want to see in the http-header Host: www.company.example

Your hoster decides by this information which page to deliver. If you don't supply the host the server has no way to know what to deliver when there is more than one domain hosted.

BenjaminH
  • 492
  • 2
  • 9
1

This is because a web-server that serves multiple sites relies on on the "Host:" header in the HTTP request to identify which site to serve up. If your web-browser doesn't know the domain-name - because you supplied an IP-address instead - it cant tell the web-server which site to serve up.

Packet data captured using Wireshark, "follow TCP-stream":

Request using domain name

GET / HTTP/1.1
Host: redgrittybrick.org
...

Response

HTTP/1.1 200 OK
Date: Wed, 18 Oct 2017 14:27:19 GMT
...

Request using IP address

GET / HTTP/1.1
Host: 83.170.124.24
...

Response

HTTP/1.1 404 Not Found
Date: Wed, 18 Oct 2017 14:28:44 GMT
...
RedGrittyBrick
  • 1,355
  • 8
  • 14
0

The IP is the address of the server however there may be nothing set up on said server to deal with requests directly to the IP. This is pretty common.

Take Apache or Nginx for example, both these servers require you to set up vhosts to actually deal with requests to the server via a domain name.

You may have 1 physical machine with multiple domains. For each domain you set up a vhost to tell the server where to root that request.

If there is no vhost set up to deal with requests directly to the IP then you will get no response.

TrickyDupes
  • 2,809
  • 1
  • 13
  • 27