CPSA ยท Web servers, architecture and protocols
Web server operation, virtual hosting and proxies
Client/server flow, name-based virtual hosts and forward vs reverse proxies.
Key points
- Client opens TCP, sends a request line and headers; server returns a status line, headers, body.
- Name-based virtual hosting: many sites on one IP and port; the Host header picks the site, unmatched names get the default site.
- Forward proxy: for clients, who choose it.
- Reverse proxy: for servers, often unseen; TLS termination, caching, load balancing.
- Tester: a wrong Host value can reveal other sites or the default vhost.
Source: https://httpd.apache.org/docs/2.4/vhosts/name-based.html
Practice questions
Which HTTP request element does a name-based virtual host setup use to choose between sites on one IP and port?
- The User-Agent header
- The Host header
- The TCP source port
- The Accept-Language header
Show answer
Answer: B. The Host header
The Host header carries the requested hostname. The URL path and User-Agent do not select the site, and the TCP source port is chosen by the client at random.
Which of these are typical jobs of a reverse proxy placed in front of web servers?
- Terminating TLS for the back-end servers
- Distributing requests across several back-end servers
- Hiding the browser user's IP address from the sites they visit
- Running the application's SQL queries
- Letting users reach internal clients through a configured browser setting
Show answer
Answer: A. Terminating TLS for the back-end servers, B. Distributing requests across several back-end servers
Reverse proxies commonly terminate TLS, balance load and cache. Hiding the client's identity from the internet is a forward-proxy trait, and a reverse proxy does not execute the application's database queries.
True or false: a server will always respond with an error when the Host header contains a name that no virtual host defines.
Show answer
Answer: False
False. Name-based setups usually serve the first-listed (default) virtual host instead of failing.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

More CPSA topics in this module
- IIS and Apache and their typical flaws
- Tiered web architectures
- HTTP methods and response codes
- HTTPS, SOAP and security-related headers
- HTML and XML
- Server-side and client-side web languages
- Application servers and frameworks
- Server extension interfaces
- Thin and thick web clients, applets and decompilation