Skip to content

Commit

Permalink
fix(FEC-12322): add alternatives to getReferer logic (#4284)
Browse files Browse the repository at this point in the history
add alternatives to getReferer logic.

**the issue:**
in some cases, OSs/browsers, for example, OS X/Safari, will not pass $_SERVER['HTTP_REFERER'] and then the fallback would be 'http://www.kaltura.com/'. If a customer is using an ACP where certain domains are allowed (excluding kaltura.com) and the browser did not pass the HTTP_REFERER, then the player will display an error.

**solution:**
add alternatives to get/create the referer.

Solves FEC-12322
  • Loading branch information
lianbenjamin authored Jun 14, 2022
1 parent 670d1f4 commit 78066ce
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions modules/KalturaSupport/RequestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,18 @@ public function getReferer(){
if( $wgKalturaForceReferer !== false ){
return $wgKalturaForceReferer;
}
if( isset( $_SERVER['HTTP_REFERER'] ) ){
$urlParts = parse_url( $_SERVER['HTTP_REFERER'] );
if (isset( $urlParts['scheme'] ) && isset( $urlParts['host']) ) {
return $urlParts['scheme'] . "://" . $urlParts['host'] . "/";
if (!empty($_SERVER['HTTP_REFERER'])){
$urlParts = parse_url( $_SERVER['HTTP_REFERER'] );
if (isset( $urlParts['scheme'] ) && isset( $urlParts['host']) ) {
return $urlParts['scheme'] . "://" . $urlParts['host'] . "/";
}
} else if (!empty($_SERVER['HTTP_HOST'])) {
if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
$scheme = "https://";
} else {
$scheme = "http://";
}
return $scheme . $_SERVER['HTTP_HOST'];
}
return 'http://www.kaltura.com/';
}
Expand Down

0 comments on commit 78066ce

Please sign in to comment.