Message-ID: <796583148.4935.1369489882446.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4934_2129846782.1369489882445" ------=_Part_4934_2129846782.1369489882445 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
A virtual host is an alternative name, registered in DNS, for an IP addr= ess. A single IP address may have many such alternative names.
Multi-homed hosts, that is machines with more than one network interface= , may have a different name for each IP address. This is also refered to as= "virtual hosting".
Essentially, "virtual hosting" concerns the resolution of a DN= S registered name to an IP address - many names may resolve to the same IP = address, and 1 or more IP addresses may reside on the same physical machine= .
Jetty users often want to configure their web applications taking into a= ccount these different virtual hosts. Frequently, a machine with a single I= P address will have different DNS resolvable names associated with it, and = a webapp deployed on it must be reachable from all of the alternative names= .
Other possibilities are to serve different web applications from differe= nt virtual hosts.
Let's examine these possibilities.
When configuring a web application, you can supply a list of IP addresse= s and names at which the web application will be reachable. Suppose we have= a machine with these IP addresses and DNS resolvable names:
Suppose we have a webapp, xxx.war that we want to be served from all of = the above names and addresses. Then we would configure the webapp like so:<= /p>
Assuming we'd configured a connector listening on port 8080, then webapp= xxx.war would be available at all of the following addres= ses:
This is accomplished simply by supplying a different list of virtual hos= ts for each webapp. For example, suppose our imaginary machine has these DN= S names and IP addresses:
Suppose also we have another webapp, zzz.war. We want x= xx.war to be deployed as above, and zzz.war to be deployed only from 777.88= 8.888.111, www.other.com, www.other.net and www.other.org:
Webapp xxx.war is still available at:
But now webapp zzz.war is available at:
In our example above, we have made webapp zzz.war avilable not only at a=
certain set of virtual hosts, but also at the context path /zzz, whilst ou=
r other webapp is available at both a different set of virtual hosts, a=
nd at a different context path. What happens if we want them at the
same context path, but still at different sets of virtual ho=
Very simply, we just supply the same context path for e= ach webapp, leaving the disjoint set of virtual host definitions as before:=
Now, webapp xxx.war is available at:
and webapp zzz.war is available at:
International domain names are= names containing non-ascii characters. For example "http://www.b=C3= =BCcher.com". The DNS internally remains based on ascii, so these kind= s of names are translated via an encoding called punycode = into an ascii representation. Modern browsers will detect these non-ascii = characters in URLs and automatically apply the punycode encoding. For examp= le, typing this url into a browser:
is translated to the following url:
For using internationalized domain names with jetty virtual hosts, you n= eed to supply the punycoded form of the name in your context xml file (and = of course you will need to supply it to your DNS setup).
Here's an example. Say I'm running a webapp on port 8080 at context /tes= t, and I want to configure a virtual host for "www.=C3=A5=C3=A4=C3=B6.= com". I configure its ascii equivalent in the context xml file for the= context:
After starting jetty, I will be able to enter the url "http://www.= =C3=A5=C3=A4=C3=B6.com:8080/test/" in my browser and reach my webapp.<= /p>
Note that if I don't have any webapps deployed at /, hitting the url &qu= ot;http://www.=C3=A5=C3=A4=C3=B6.com:8080" will hit jetty's default ha= ndler, which serves back a 404 page listing the available contexts:
You'll notice that the link already has the punycode transformed domain = name in it.------=_Part_4934_2129846782.1369489882445--