Issues

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

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