Tomcat Connector - How can I configure one Connector's requests to be handled by only one of my webapps?

If you have two or more Connector elements configured, and you want each Connector's requests to be handled by only one of your webapps, you do not need two separate Tomcat instances to accomplish this.  In your server.xml file, you'll notice that your HTTPS Connector elements are nested within a Service element.  Also nested within the Tomcat Service element is an Engine element that in turn contains your Host(s) and Context(s), like this (simplified):

<Server>
  <Service>
    <Connector port="8443"/>
    <Connector port="8444"/>
    <Engine>
      <Host name="yourhostname">
        <Context path="/webapp1"/>
        <Context path="/webapp2"/>
      </Host>
    </Engine>
  </Service>
</Server>

Tomcat matches up the Connectors with the Engine and the Engine's Hosts and Contexts.  Tomcat also supports having more than one Service element in server.xml, which means you can change the structure so that only one connector is able to send requests to one webapp, like this:

<Server>
  <Service name="Catalina">
    <Connector port="8443"/>
    <Engine>
      <Host name="yourhostname">
        <Context path="/webapp1"/>
      </Host>
    </Engine>
  </Service>
  <Service name="Catalina8444">
    <Connector port="8444"/>
    <Engine>
      <Host name="yourhostname">
        <Context path="/webapp2"/>
      </Host>
    </Engine>
  </Service>
</Server>
 

There you go-- Tomcat connector explained. Google Tomcat Connector HTTP and AJP to learn more
Comments on this post:
 #

what is workers.properties?

 

Post new comment

The content of this field is kept private and will not be shown publicly.

Download Tcat Server - Tomcat Simplified

Develop, diagnose, manage, configure, and deploy your Apache Tomcat applications with ease, and break free from bloated legacy JEE app servers. Built on 100% Tomcat, with no changes to the core code, Tcat Server is free for developers, and there is no commitment required. Try it now, risk-free! 
 

click thumbnail to enlarge

Link to this page