Bitzu

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

Single choice

Which HTTP request element does a name-based virtual host setup use to choose between sites on one IP and port?

  1. The User-Agent header
  2. The Host header
  3. The TCP source port
  4. 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.

Select all that apply

Which of these are typical jobs of a reverse proxy placed in front of web servers?

  1. Terminating TLS for the back-end servers
  2. Distributing requests across several back-end servers
  3. Hiding the browser user's IP address from the sites they visit
  4. Running the application's SQL queries
  5. 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

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.

Download on the App StoreGet it on Google Play

More CPSA topics in this module