Skip to content

Commit be04c86

Browse files
committed
Merge pull request facebookarchive#114 from moisadoru/master
Support for multiple chained forward proxies in getHttpHost()
2 parents ab2798f + d0735d0 commit be04c86

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/base_facebook.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,10 @@ protected function getUrl($name, $path='', $params=array()) {
11821182

11831183
protected function getHttpHost() {
11841184
if ($this->trustForwarded && isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
1185-
return $_SERVER['HTTP_X_FORWARDED_HOST'];
1185+
$forwardProxies = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
1186+
if (!empty($forwardProxies)) {
1187+
return $forwardProxies[0];
1188+
}
11861189
}
11871190
return $_SERVER['HTTP_HOST'];
11881191
}

0 commit comments

Comments
 (0)