Jetty Logo
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

Configuring Virtual Hosts

Virtual Host Names

A virtual host is an alternative name, registered in DNS, for an IP address such that multiple domain names will resolve the the same IP of a shared server instance. If the content to be served to the aliases names is different, then a virtual host names need to be configured for each deployed context to indicate which names a context will respond to.

Virtual hosts are set on a context by calling the setVirtualHosts or addVirtualHost method which can be done either

Virtual Host Names

Jetty supports the following styles of virtual host name:

A fully qualified host name. It is important to list all variants as a site may receive traffic from both and just


A wildcard qualified host which will match only one level of arbitrary names. * will match and, but not

An IP address may be given as a virtual host name to indicate that a context should handle requests received on that server port that do not have a host name specified (HTTP/0.9 or HTTP/1.0)


A connector name, which is not strictly a virtual host, but instead will only match request that are received on connectors that have a matching name set with Connector.setName(String).


Non ascii and IDN domain names can be set as virtual host using Puny Code equivalents that may be obtained from a Punycode/IDN converters. For example if the non ascii domain name www.√ is given to a browser, then it will make a request that uses the domain name, which is the name that should be added as the virtual host name.

See an error or something missing? Contribute to this documentation at Github!