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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to