Miten Web-palvelimet tietävät käytätkö suoran IP-osoitteen käyttöä vai ei?

Sisällysluettelo:

Miten Web-palvelimet tietävät käytätkö suoran IP-osoitteen käyttöä vai ei?
Miten Web-palvelimet tietävät käytätkö suoran IP-osoitteen käyttöä vai ei?

Video: Miten Web-palvelimet tietävät käytätkö suoran IP-osoitteen käyttöä vai ei?

Video: Miten Web-palvelimet tietävät käytätkö suoran IP-osoitteen käyttöä vai ei?
Video: Pauli Niemelä: "Sosiaalityöllä on valtavasti mahdollisuuksia" - YouTube 2024, Huhtikuu
Anonim
Tavallisesti kirjoitamme vain haluamasi verkkosivun osoitteen, mutta olisiko web-palvelin todella "tiedä", jos käytimme sen sijaan suoran IP-osoitteen? Tänään SuperUser Q & A -postilla on vastaus hämmentynyt lukijan kysymykseen.
Tavallisesti kirjoitamme vain haluamasi verkkosivun osoitteen, mutta olisiko web-palvelin todella "tiedä", jos käytimme sen sijaan suoran IP-osoitteen? Tänään SuperUser Q & A -postilla on vastaus hämmentynyt lukijan kysymykseen.

Tämän päivän kysymys- ja vastausistunto tulee meihin SuperUserin hyväksi - Stack Exchangein alaosasto, joka on yhteisöllinen Q & A-sivustojen ryhmittely.

Kuva Cory M. Grenieristä (Flickr).

Kysymys

SuperUser-lukija Joseph A. haluaa tietää, miten web-palvelimet voivat selvittää käytätkö suoran IP-osoitteen vai ei:

Some web servers, when accessed using their IP address, return an error that direct IP address access is not allowed. I have been wondering for some time how this works.

Does a browser always resolve the IP address and connect to it? Direct IP address access is just skipping DNS altogether, right? How does a remote server even know that you skipped DNS?

Miten web-palvelimet tietävät, käytätkö suoran IP-osoitteen käyttöä vai ei?

Vastaus

SuperUser-avustajan iAdjunctilla on vastaus meille:

To answer your question of how it knows, it has to do with what your browser sends the web server. You are right that the system always resolves it to an IP address, but the browser sends the URL you attempted to access in the HTTP header.

Here is a sample header that I found online, modified to look as though you used Firefox on Windows and typed apple.com into the address bar:

Here is what the header would look like if you used its IP address:
Here is what the header would look like if you used its IP address:
Both of these would be sent to the same IP address over a socket, but the browser tells the web server what it accessed. Why? Because web servers with the same IP address may host multiple websites and give different pages for each. It cannot distinguish who wants which page by IP address because they all have the same one, but it can distinguish them by the HTTP header.
Both of these would be sent to the same IP address over a socket, but the browser tells the web server what it accessed. Why? Because web servers with the same IP address may host multiple websites and give different pages for each. It cannot distinguish who wants which page by IP address because they all have the same one, but it can distinguish them by the HTTP header.

Onko jokin asia lisättävä selitykseen? Kuulkaa kommentit. Haluatko lukea lisää vastauksia muilta tech-tajuilta Stack Exchange-käyttäjiltä? Katso koko keskusteluketju täältä.

Suositeltava: