spring-projects/spring-hateoas — pull request #170 by darklynx (2014-04-15 10:24:10+00:00)
Title: better support for forwarding proxy headers

The common situation is that external proxy listens to default ports (HTTP - 80, HTTPS - 443), but forwards request to internal services running on custom ports.

For example: https://example.com/* is forwarded to http://internal.ip:8080/*
Usually "X-Forwarded-Host" header in this case will refer to "example.com", and the current logic will generate external resource URLs as: https://example.com:8080/* (if "X-Forwarded-Ssl" is set to "on").

This patch will reset the port in URI builder if "X-Forwarded-Host" does not contain port information.
It also provides support for "X-Forwarded-Port" header in case of more complex scenarios.