ZF2-508: Return proper server host name when behind a proxy
Description
\Zend\View\Helper\ServerUrl does not take into account when the request is coming from a proxy server. Here is that patch.
if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
if (strpos($host, ',')) {
// See Symfony ticket #3842 (http://trac.symfony-project.org/ticket/3842)
$hosts = explode(',', $host);
$host = array_pop($hosts);
}
$this->setHost($host);
} elseif (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
Comments
Posted by John Kelly (postalservice14) on 2012-08-31T15:04:30.000+0000
Pull request sent: https://github.com/zendframework/zf2/pull/2279
Posted by Ralph Schindler (ralph) on 2012-10-08T20:14:46.000+0000
This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2546