tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: redirect request from 8080 to port 80
Date Wed, 15 May 2013 22:14:31 GMT
On 15/05/2013 22:56, André Warnier wrote:
> Mark Thomas wrote:
>> On 15/05/2013 17:15, André Warnier wrote:

>>> I find it less intuitive because of the Javadoc of
>>> HttpServletRequest.getLocalPort :
>>>  getLocalPort
>>>
>>> int getLocalPort()
>>>
>>>     Returns the Internet Protocol (IP) port number of the interface on
>>> which the request was received.
>>>
>>>     Returns:
>>>         an integer specifying the port number
>>>     Since:
>>>         Servlet 2.4
>>>
>>> So that is the interface (the Connector), not the port number mentioned
>>> in the Host header.
>>
>> Yes, but with the caveat that proxyPort will change the result of that
>> call.

Sorry, getting my ports mixed up.

getLocalPort() always returns the port the server is listening on

getServerPort() returns the port in the HTTP request but this is
overridden by the setting of proxyPort

> Suppose one has one Tomcat, with the HTTP Connector configured to listen
> on port 8080.
> And suppose that one has 2 proxies (with different names) each listening
> on port 80 and forwarding requests to that one Tomcat on port 8080.
> There would then be no possibility to configure Tomcat so as to respond
> correctly to both proxies, no ?
> (While if it was using the content of the Host header, it could).

That depends on the proxy configuration. If they preserve the host
header it should be fine. If they were on different ports you might have
a problem. Two connectors would be the solution if there was an issue.

Mark

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


Mime
View raw message