Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

share|improve this question

1 Answer 1

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

share|improve this answer
    
I used the host-manager, and when I look in the server.xml there are no hosts defined. Which config file does the host-manager webapp write to? But according to you wildcards should be possible? –  Marten Sytema Jan 22 '11 at 12:52
    
I normally don't use the host-manager and rather write directly to the configuration files, reading about it though makes me think that the alias parameter in the manager will do the same as I was explaining just before, try it out and see how it works for you. –  lynxman Jan 22 '11 at 16:27
    
@MartenSytema there should be at least one Host. The default one is called localhost. If you only have "localhost" then your virtual hosting may be happening in a different component, such as an Apache HTTP server before being proxied to Tomcat –  Alastair McCormack Oct 7 '12 at 9:26
    
-1 I tried using a wildcard in the <Alias> element and tomcat didn't route requests as expected. Furthermore, the tomcat configuration docs for <Alias> mention nothing at all about wildcard support. –  Asaph Jun 1 at 21:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.