Open x12a1f opened 10 years ago
Thanks Ralph for the report. We are almost done with 2.2.1 release, but I'm assigning this issue to @thboileau who might get a chance to check it out tomorrow
The port is not the only one issue. I wonder what happen if apache proxies distinct path for example: "/context/path" to "/mysrestletapp" postponed to 2.2.2
When a restlet (2.2.0) application is running on tomcat behind an apache proxy, the port number in the Reference returned by Resource#getReference() is incorrect. This Reference uses the port tomcat is listening on instead of the port apache is listening on.
Apache is correctly configured to pass this port to tomcat as described here : http://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html
According to the tomcat proxy howto ServletRequest.getServerPort() should be used to get the port. So I think this https://github.com/restlet/restlet-framework-java/blob/master/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletAdapter.java#L130 should use getServerPort() and not getLocalPort() But getLocalPort() is used in multiple locations in the servlet extension.
By not using the correct port the Reference returned by getReference() is incorrect. But also a redirect by the Directory module is using the wrong port number.
If there is an easy way of compiling restlet and use it with maven I can test it. I am not very good with ant but and I tried to test it but it failed to install on the tomcat-behind-apache server due to dependencies.