I have an httpd server configured to work with HTTPS connections and forward connections to Tomcat (via http or ajp) where requests are processed. One of the requirements that I have on the Tomcat server is to register the remote port number of each request. If I immediately got into Tomcat, retrieving the remote port number directly, and we are currently doing this using the getRemotePort()(HttpServletRequest) function .
However, since I am doing a reverse proxy (forwarding HTTPS requests via HTTP / AJP), a new connection will be created, and I always get a remote port (and a remote IP address) to connect from my httpd server to tomcat (unless I am using AJP. In this case, the IP address information of the remote server is arriving correctly).
I tried different configurations on httpd, for example:
ProxyPreserveHost On
ProxyPass / ajp://localhost:8009/
or
ProxyPreserveHost On
ProxyPass / http://localhost:8081/
I also played a little with RewriteRules, but couldn't get everything to work.
Reading httpd documentation, mod_proxy offers request header information for things like X-Forwarded-Host, X-Forwarded-Foretc. But there is no information about the source port.
I even found an error where, apparently, the attribute X-Forwarded-Portwas added to the header of the proxy request, but this code did not seem to do to the main line / branch.
, , ( ), HTTPD Tomcat?