mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Added support for fastly cdn (#1327)
* Added support for Fastly CDN Co-Authored-By: Cønstantine Kovalensky <45331093+kovalensky@users.noreply.github.com> * Update common.php Co-Authored-By: Cønstantine Kovalensky <45331093+kovalensky@users.noreply.github.com> --------- Co-authored-by: Cønstantine Kovalensky <45331093+kovalensky@users.noreply.github.com>
This commit is contained in:
parent
a46c40e106
commit
a438031c68
1 changed files with 6 additions and 3 deletions
|
@ -41,9 +41,12 @@ if (!defined('BB_SCRIPT')) {
|
||||||
header('X-Frame-Options: SAMEORIGIN');
|
header('X-Frame-Options: SAMEORIGIN');
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
// Cloudflare
|
// Set remote address
|
||||||
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
$allowedCDNs = ['HTTP_X_FORWARDED_FOR', 'HTTP_FASTLY_CLIENT_IP', 'HTTP_CF_CONNECTING_IP'];
|
||||||
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
|
foreach ($allowedCDNs as $allowedCDN) {
|
||||||
|
if (isset($_SERVER[$allowedCDN]) && filter_var($_SERVER[$allowedCDN], FILTER_VALIDATE_IP)) {
|
||||||
|
$_SERVER['REMOTE_ADDR'] = $allowedCDN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all constants
|
// Get all constants
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue