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:
the returned URLs are like: