You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/03/28 20:07:04 UTC

DO NOT REPLY [Bug 18478] New: - Services on different ports accessing each other's webapps.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18478>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18478

Services on different ports accessing each other's webapps.

           Summary: Services on different ports accessing each other's
                    webapps.
           Product: Tomcat 4
           Version: 4.1.12
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: bbc@dataconnection.com


Tomcat seems to be confused when multiple services are listening on different 
ports.  It is able to serve up files from webapps that are not configured for 
that service.  In addition you can request files based on the name of the 
webapp directory in which they live, as well as the path of the webapp 
specified in the <Context> element in server.xml (last example below).

I'm afraid that this isn't clear, so here are some examples which make clear 
what I mean.

I have two webapps set up in different services, one (ROOT) listening on port 
80 and the other (test) on port 8080.  My server.xml is appended below.

With this setup, the requests

  http://localhost:80/test/
  http://localhost:8080/test/

both return the directory listing for the 'test' webapp.  This result is 
unaffected by whether or not there is a directory named 'test' in the ROOT 
webapp.

The requests

  http://localhost:80/
  http://localhost:8080/

both return the directory listing for the ROOT webapp.

However the log for each request is written to the expected access log file.  
Requests to port 80 result in logs to the ROOT access log; those to port 8080 
result in logs to the 'test' access log.

If I change the <Context> element for the 'test' webapp to be

  <Context path="" docBase="test" debug="0"/>

the requests

  http://localhost:80/test/
  http://localhost:8080
  http://localhost:8080/test/

all return the same thing, the directory listing of the 'test' webapp.  The 
port on which the request is made alters only where the access log is written 
as before.

If I now change the <Context> element for the 'test' webapp to be

  <Context path="/some-other-path" docBase="test" debug="0"/>

the requests

  http://localhost:80/test/
  http://localhost:80/some-other-path/
  http://localhost:8080/test/
  http://localhost:8080/some-other-path/

all return the directory listing of the 'test' webapp.  Logs written as before.

Expected behaviour:
 - requests to a certain port are served by the service listening on
   that port, from the webapp configured for that port;
 - requests which refer to the directory name (docBase) of a webapp,
   rather than the specified path, should fail.

-- -- --

server.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN" debug="0">
  <Service name="Tomcat-Standalone">
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="80" minProcessors="5" maxProcessors="1000"
               enableLookups="true" redirectPort="443" acceptCount="10"
               debug="0" connectionTimeout="60000" scheme="http"
               secure="false"/>
    <Engine name="Standalone" defaultHost="localhost" debug="0">
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt" timestamp="true"/>
      <Realm className="org.apache.catalina.realm.MemoryRealm"/>
      <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
               directory="logs" prefix="localhost_access_log."
               suffix=".txt" pattern="common"/>
        <Logger className="org.apache.catalina.logger.FileLogger"
                directory="logs" prefix="localhost_log." suffix=".txt"
                timestamp="true"/>
        <Context path="" docBase="ROOT" debug="0"/>
      </Host>
    </Engine>
  </Service>
  <Service name="test">
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8080" minProcessors="5" maxProcessors="1000"
               enableLookups="true" redirectPort="443" acceptCount="10"
               debug="0" connectionTimeout="60000" scheme="http"
               secure="false"/>
    <Engine name="Standalone" defaultHost="localhost" debug="0">
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="test_catalina_log." suffix=".txt" timestamp="true"/>
      <Realm className="org.apache.catalina.realm.MemoryRealm"/>
      <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
               directory="logs" prefix="test_localhost_access_log."
               suffix=".txt" pattern="common"/>
        <Logger className="org.apache.catalina.logger.FileLogger"
                directory="logs" prefix="test_localhost_log." suffix=".txt"
                timestamp="true"/>
        <Context path="/test" docBase="test" debug="0"/>
      </Host>
    </Engine>
  </Service>
</Server>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org