เซิร์ฟเวอร์ของเว็บรู้ได้อย่างไรว่าคุณใช้การเข้าถึงที่อยู่ IP โดยตรงหรือไม่?

สารบัญ:

วีดีโอ: เซิร์ฟเวอร์ของเว็บรู้ได้อย่างไรว่าคุณใช้การเข้าถึงที่อยู่ IP โดยตรงหรือไม่?

วีดีโอ: เซิร์ฟเวอร์ของเว็บรู้ได้อย่างไรว่าคุณใช้การเข้าถึงที่อยู่ IP โดยตรงหรือไม่?
วีดีโอ: สอนวิธีต่อซาวด์บาร์กับทีวีง่ายๆ ใครๆ ก็ทำได้ !! 2024, มีนาคม
เซิร์ฟเวอร์ของเว็บรู้ได้อย่างไรว่าคุณใช้การเข้าถึงที่อยู่ IP โดยตรงหรือไม่?
เซิร์ฟเวอร์ของเว็บรู้ได้อย่างไรว่าคุณใช้การเข้าถึงที่อยู่ IP โดยตรงหรือไม่?
Anonim
โดยปกติแล้วเราจะพิมพ์ที่อยู่ของเว็บไซต์ที่เราต้องการดู แต่เว็บเซิร์ฟเวอร์จะ "รู้" จริงหรือไม่ถ้าเราใช้ที่อยู่ IP โดยตรงแทน? โพสต์ SuperUser Q & A ในวันนี้มีคำตอบสำหรับคำถามของผู้อ่านที่สับสน
โดยปกติแล้วเราจะพิมพ์ที่อยู่ของเว็บไซต์ที่เราต้องการดู แต่เว็บเซิร์ฟเวอร์จะ "รู้" จริงหรือไม่ถ้าเราใช้ที่อยู่ IP โดยตรงแทน? โพสต์ SuperUser Q & A ในวันนี้มีคำตอบสำหรับคำถามของผู้อ่านที่สับสน

เซสชั่นคำถามและคำตอบในวันนี้มาถึงเราโดยสุจริตของ SuperUser ซึ่งเป็นแผนกย่อยของ Stack Exchange ซึ่งเป็นกลุ่มเว็บไซต์ Q & A ที่ขับเคลื่อนโดยชุมชน

ภาพโดย Cory M. Grenier (Flickr)

คำถาม

ผู้อ่าน SuperUser Joseph A. ต้องการทราบว่าเว็บเซิร์ฟเวอร์สามารถบอกได้ว่าคุณใช้การเข้าถึงที่อยู่ IP โดยตรงหรือไม่:

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?

เซิร์ฟเวอร์เว็บจะรู้ได้อย่างไรว่าคุณใช้การเข้าถึงที่อยู่ IP โดยตรงหรือไม่?

คำตอบ

ผู้สนับสนุน SuperUser iAdjunct มีคำตอบสำหรับเรา:

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.

มีบางอย่างที่จะเพิ่มคำอธิบายหรือไม่? เสียงออกในความคิดเห็น ต้องการอ่านคำตอบเพิ่มเติมจากผู้ใช้ Stack Exchange ที่มีความเชี่ยวชาญด้านเทคโนโลยีหรือไม่? ดูหัวข้อการสนทนาฉบับเต็มได้ที่นี่