Skip to content

Commit

Permalink
Merge pull request #27 from jasir/feature/cors-non-80-port
Browse files Browse the repository at this point in the history
ApiPresenter: getRequestDomain() returns port as well
  • Loading branch information
tomaj committed Apr 3, 2016
2 parents 7116d18 + 3d19888 commit d339f37
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Presenters/ApiPresenter.php
Expand Up @@ -219,7 +219,11 @@ private function getRequestDomain()
if (filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
$refererParsedUrl = parse_url(filter_input(INPUT_SERVER, 'HTTP_REFERER'));
if (isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host'])) {
return $refererParsedUrl['scheme'] . '://' . $refererParsedUrl['host'];
$url = $refererParsedUrl['scheme'] . '://' . $refererParsedUrl['host'];
if (isset($refererParsedUrl['port']) && $refererParsedUrl['port'] !== 80) {
$url .= ':' . $refererParsedUrl['port'];
}
return $url;
}
}
return false;
Expand Down

0 comments on commit d339f37

Please sign in to comment.