Jakub Bocheński created CXF-4631:
------------------------------------

             Summary: HttpUtils.toAbsoluteUri should use 
request.getServerPort() instead of request.getLocalPort()
                 Key: CXF-4631
                 URL: https://issues.apache.org/jira/browse/CXF-4631
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.7.0
            Reporter: Jakub Bocheński
            Priority: Minor


I believe the toAbsoluteUri() helper method should use the getServerPort() 
method of HttpServletRequest.

The host name is already taken from the Host header, so it's inconsistent to 
return the port number of the interface on which the request was received, 
instead of the port value contained in the Host header.

Anyhow I'd presume that the client would expect to receive an URL based on the 
address it used.

I run into this when I put an SSH tunnel to a server where the CXF-based 
application was running:
{{ssh -L 5555:localhost:80 myappserver}}
Although I send requests to:
 {{http://myapp:5555/path}}
the returned URLs are like:
 {{http://myapp/path2}}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to