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/02/08 09:29:27 UTC

DO NOT REPLY [Bug 16901] New: - wrong server port when using NAT

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=16901>.
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=16901

wrong server port when using NAT

           Summary: wrong server port when using NAT
           Product: Tomcat 4
           Version: 4.1.18
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:Coyote JK 2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: apache@kshakir.org


I believe in file "jk_service_apache2.c", in method "jk2_init_ws_service"

    /* get server name */
    s->server_name= (char *)(r->hostname ? r->hostname :
                             r->server->server_hostname);

    /* get the real port (otherwise redirect failed) */
    apr_sockaddr_port_get(&port,r->connection->local_addr);
    s->server_port = port;

  Should be
    
    /* get server name */
    s->server_name= (char *)ap_get_server_name(r);

    /* get the real port (otherwise redirect failed) */
    s->server_port = ap_get_server_port(r);

My setup:
Apache's listening on port 8001. NAT in front of Apache (for other technical 
reasons) is listening on 80, forwarding to 8001.

When Apache receives a request it knows the request is for the external port 80-
I can tell by going to a non existent page, ex. "Apache/2.0.44 (Win32) 
mod_jk2/2.0.2 Server at [site] Port 80"

-BUT-

By the time Tomcat gets the request through jk2, it thinks the port is 8001. If 
I go to http://[site]:80/examples/jsp/snp/snoop.jsp everything's correct except 
Server port.

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