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 2001/10/19 00:39:36 UTC
DO NOT REPLY [Bug 4280] New: -
Server port not set in HttpProcessor host header does not contain port
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=4280>.
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=4280
Server port not set in HttpProcessor host header does not contain port
Summary: Server port not set in HttpProcessor host header does
not contain port
Product: Tomcat 4
Version: 4.0 Final
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Catalina
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: chi@atypon.com
Symptom:
We are using a load balancer that listens on port 80. And tomcat 4 is running
on several different machines on port 8080. When I accessed the virtual host on
the local balancer http://somehostname.com/, it redirected me to the welcome
file "start.jsp" (defined in my web.xml). But it set the port number
incorrectly to http://somehostname.com:8080/start.jsp in the redirect location.
Solution:
I found that in org.apache.catalina.connector.http.HttpProcessor, it checks the
host header in the http request. But if the port number is not found in the
host, it simply ignores it, which means it use the port number defined in
server.xml for this connector. It should set the port to 80 in the request
object if the port number is not found in the host header.
Here is the modified code in the parseHeaders(SocketInputStream) method:
} else if (header.equals(DefaultHeaders.HOST_NAME)) {
int n = value.indexOf(':');
if (n < 0) {
if (proxyName != null)
request.setServerName(proxyName);
else
{
request.setServerName(value);
request.setServerPort(80);
}
...
...
Chi