Page MenuHomePhabricator
Paste P1714

lb.php
ActivePublic

Authored by epriestley on Feb 2 2015, 9:11 PM.
Tags
None
Referenced Files
F281208: lb.php
Feb 2 2015, 9:11 PM
Subscribers
None
// If this request is coming from within the cluster, we'll trust HTTP
// headers added by the load balancer. We do not trust these headers for
// requests which do not originate from within the cluster, because they
// are client-controlled if the request is being received directly.
if (PhacilityServices::isClusterRequest()) {
// Since we terminate SSL at the ELB, requests are normally HTTP by the
// time they reach the server, even if they were originally HTTPS. The
// ELB sets this header to indicate that the original request was HTTPS.
if (idx($_SERVER, 'HTTP_X_FORWARDED_PROTO') == 'https') {
$_SERVER['HTTPS'] = true;
}
$forwarded_for = idx($_SERVER, 'HTTP_X_FORWARDED_FOR');
if ($forwarded_for) {
$_SERVER['REMOTE_ADDR'] = $forwarded_for;
}
}

Event Timeline

epriestley changed the title of this paste from untitled to lb.php.
epriestley updated the paste's language from autodetect to autodetect.