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

I have some web apps deployed on Tomcat, using the following configuration:

<Engine ...>
    <Host name="a.mycompany.com" ...>
    <Host name="b.mycompany.com" ...>
    <Host name="c.mycompany.com" ...>

For each of these apps, I can access them at the following two URLs:


Where x is a, b or c.

Is this normal, or have I done something wrong?

share|improve this question

1 Answer 1

Yes, this is the default configuration.

You have deployed all 3 web apps on a single Tomcat instance - so they will be accessible by default as

http://<some-domain-url>/x where x = a,b or c

Are you looking to restrict the pattern to

http://a.mycompany.com/a or http://b.mycompany.com/b and

disallow http://a.mycompany.com/b ?

Then try nesting the web app via a <Context> element in the server.xml within your

<Host name="a.mycompany.com" ...>

Like so:

<Host name="a.mycompany.com" appBase="webapps"> 
    <Context path="/a" docBase="/a/"/> 

      <Host name="b.mycompany.com" appBase="webapps"> 
    <Context path="/b" docBase="/b/"/> 

If path is set to "" then you can get the app at the ROOT context, like a.mycompany.com instead of a.mycompany.com/a

share|improve this answer
What I want to achieve is a.mycompany.com being the only way accessing a - a.mycompany.com/a should give a 404 –  Rich Dec 9 '10 at 12:23
I dont think that is possible with Tomcat alone. You need an Apache to front it to redirect to a 404 error page on that URL pattern –  JoseK Dec 9 '10 at 12:31

Your Answer


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.