Skip to content

Commit

Permalink
Fix for magento#12969 - server port detection for errors
Browse files Browse the repository at this point in the history
Updates `getHostUrl()` method to reference `HTTP_HOST` rather than `SERVER_PORT`.
  • Loading branch information
Logan Stellway authored Oct 4, 2018
1 parent 18dcf17 commit 422d244
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pub/errors/processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,11 @@ public function getHostUrl()
$isSecure = (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] != 'off');
$url = ($isSecure ? 'https://' : 'http://') . $host;

if (!empty($_SERVER['SERVER_PORT']) && !in_array($_SERVER['SERVER_PORT'], [80, 443])
$port = explode(':', $host);
if (isset($port[1]) && !in_array($port[1], [80, 443])
&& !preg_match('/.*?\:[0-9]+$/', $url)
) {
$url .= ':' . $_SERVER['SERVER_PORT'];
$url .= ':' . $port[1];
}
return $url;
}
Expand Down

0 comments on commit 422d244

Please sign in to comment.