Jetty Logo
Contact the core Jetty developers at www.webtide.com

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:

www.hostname.com

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

*.hostname.com

A wildcard qualified host which will match only one level of arbitrary names. *.foo.com will match www.foo.com and m.foo.com, but not www.other.foo.com

10.0.0.2

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)

@ConnectorName

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).

www.√integral.com

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.√integral.com is given to a browser, then it will make a request that uses the domain name www.xn--integral-7g7d.com, 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!