Cybersecurity glossary

What is a Virtual Host?

Learn what a virtual host is, how name-based and IP-based virtual hosting work, how Host headers and SNI route TLS sites, and which misconfigurations cause security incidents.

DNS and infrastructureUpdated July 22, 2026
Also known asvhostName-based virtual hostingVirtual hosting

Definition

A virtual host is a configuration that allows one server or reverse proxy to host multiple websites or applications—usually distinguished by hostname (name-based) or by IP address—so many domains can share the same infrastructure.

Why virtual hosts matter

IP addresses are scarce and operationally expensive to dedicate per website. Hosting platforms, reverse proxies, and shared servers need one listener to serve thousands of domains.

Virtual hosts make that possible: DNS points many names at one address, and the server selects the right application, document root, and certificate based on the requested hostname.

Name-based virtual hosting flow

1

DNS maps the hostname to a shared address

Many domains can resolve to the same VIP or anycast edge.

2

TLS handshake may include SNI

For HTTPS, the client indicates which hostname’s certificate it expects.

3

HTTP request carries Host / :authority

The application-layer hostname confirms which virtual host is intended.

4

Server matches a vhost configuration

Rules select document roots, upstreams, headers, and access policies.

5

Unmatched names hit the default host

A safe default should reject unknown hosts rather than serve a random site.

6

Response returns for that hostname only

Cookies, HSTS, and cache keys must stay bound to the correct host.

Virtual hosting types

TypeDistinguisherNotes
Name-basedHostname (Host/SNI)Default on modern shared hosting and ingress
IP-basedDestination IP addressStill used for special compliance or legacy TLS cases
Port-basedTCP portRare for public sites; more for internal admin listeners

Where virtual hosts are configured

Web servers

Apache vhosts, nginx server blocks, and similar per-hostname configs.

Reverse proxies and ingress

Path and host routing to upstream services in Kubernetes and API gateways.

CDN and edge platforms

Hostname-to-property mappings with per-host TLS and cache policies.

Application frameworks

Some apps also enforce allowed host lists to stop Host header attacks.

Security pitfalls

Dangerous default vhosts

Unknown Host values should not land on an admin app or another tenant’s site.

Host header attacks

Password-reset links and cache keys that trust Host blindly can be poisoned.

Certificate mismatches

Wrong SNI selection or missing SAN entries create client errors and downgrade confusion.

Cache key confusion

If caches ignore Host, one site’s response can be served for another.

Operational checklist

  • Maintain an explicit inventory of hostnames and their vhost/upstream mappings.
  • Configure a deny/default virtual host for unrecognized Host values.
  • Validate Host/:authority against an allowlist in application code for sensitive flows.
  • Ensure TLS certificates cover every public hostname (SAN/wildcard strategy documented).
  • Include Host in CDN/proxy cache keys whenever responses are host-specific.
  • Test HTTP and HTTPS separately for Host/SNI mismatch behavior.
  • Monitor requests hitting the default vhost—they often signal scanning or misconfig.
  • Review cookie Domain attributes so sessions do not unexpectedly span sibling hosts.

The practical takeaway

A virtual host lets one server or proxy present many sites by hostname (or sometimes by IP). It is the foundation of shared hosting, ingress routing, and multi-domain edges.

Configure defaults safely, treat Host/SNI as security-sensitive inputs, and keep certificates and cache keys aligned with each hostname you serve.

Related security terms

Frequently asked questions

What is a virtual host in simple terms?

It is a way for one machine (or proxy) to serve many websites. The server looks at the domain name you asked for and chooses the matching site configuration.

What is name-based vs IP-based virtual hosting?

Name-based uses the hostname (Host header / SNI). IP-based gives each site a distinct IP. Name-based is far more common on the modern web.

Why is the Host header important?

It tells HTTP/1.1+ servers which virtual host you want when many hostnames share an IP.

What is SNI?

Server Name Indication—a TLS extension that sends the hostname during the handshake so the server can pick the right certificate before HTTP starts.

What is a default virtual host?

The catch-all site used when the requested hostname does not match any configured name. Leaving it as a random app is a common security mistake.

Can virtual hosts leak other tenants’ data?

Yes if routing is wrong, caches key poorly, or a default host serves another customer’s content.

Do containers change virtual hosting?

They shift where vhosts live—often on an ingress controller—but the hostname-routing idea remains the same.

References

Explore authoritative guidance and frameworks related to virtual host.

Explore every security definition

Return to the glossary to search by term, alias, starting letter, or security category.

Browse glossary