Proxy header detection should honor X-Forwarded-Port.

A 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 current logic will generate invalid 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.