What is a virtual host? relating to web servers

373 views

I understand the basic premise of web servers, but have never quite wrapped my head around what the hell a virtual host is or means, please ELI5!

In: 2

7 Answers

Anonymous 0 Comments

Originally HTTP was designed with the assumption that every domain has its own IP address.

Meaning if you want to host multiple websites on a single machine, you needed to give that machine multiple IP addresses (or you can workaround by putting one of them on a different port, but this was not common for user-facing websites, as you’d have to put the port in the URL like this: http://example.com:9731 ).

In HTTP/1.1 they made it mandatory for clients to send a “Host:” header with the domain you’re asking for. This solves the problem and lets you run multiple websites, as the web server can see “Host: www.example.com” and do something different than “Host: www.myothersite.com”

HTTP/1.1 was released in 1997, so at this point every HTTP client has supported it for decades.

You are viewing 1 out of 7 answers, click here to view all answers.