Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Configuring virtual hosts with non-ascii characters

International domain names are names containing non-ascii characters. For example "http://www.bü". The DNS internally remains based on ascii, so these kinds 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 example, typing this url into a browser:

No Format

is translated to the following url:

No Format

For using internationalized domain names with jetty virtual hosts, you need 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 /test, and I want to configure a virtual host for "www.åäö.com". I configure its ascii equivalent in the context xml file for the context:

Code Block

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
  <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/test.war</Set>
  <Set name="virtualHosts">
    <Array type="String">

After starting jetty, I will be able to enter the url "http://www.åäö.com:8080/test/" in my browser and reach my webapp.

Note that if I don't have any webapps deployed at /, hitting the url "http://www.åäö.com:8080" will hit jetty's default handler, which serves back a 404 page listing the available contexts:


Error 404 - Not Found

No context on this server matched or handled this request.

Contexts known to this server are:

  • /test @ ---> WebAppContext@82d210@82d210/test,file:/tmp/Jetty_0_0_0_0_8080_test.war__test_www.xn..4cab6c.com_1jadjg/webapp/,/home/janb/src/jetty-eclipse/jetty/trunk/jetty-distribution/target/distribution/webapps/test.war

You'll notice that the link already has the punycode transformed domain name in it.

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