[FIXED JENKINS-23294] Deal with X-Forwarded-Port

See [JENKINS-23294](https://issues.jenkins-ci.org/browse/JENKINS-23294) for background. I have tried to test this using [jglick/jenkins-demo-reverse-proxy](https://index.docker.io/u/jglick/jenkins-demo-reverse-proxy/), purposely breaking the proxy configuration in various ways, and it seems to work as expected. But there may be subtleties I am missing.