using wildcards in host-aliases for Tomcat's virtual hosts

I want to do the following with Tomcat 5.5:

*.mydomain.com should go to my webapp, located at the virtual host mydomain.com. So I have a virtual host mydomain.com, and I want all *.mydomain.com also go there.

Now, if I do this, it doesn't pick up the virtual host, and just goes to the default one (which is not set to mydomain.com).

How to fix this? I basically would like to allow wildcards in the host alias, or in the virtual host name itself.

(The DNS settings are alright by the way)


Have you tried adding an alias to your Host directive in the config?

<Host name="www.mycompany.com" ...> ... <Alias>*.mydomain.com</Alias> ... </Host>

This usually fixes it for me