Considering X-Forwarded-Host header if proxy is trusted
Merge pull request #1564 from cdauth/master

Consider X-Forwarded-Host if proxy is trusted