| @@ 169-182 (lines=14) @@ | ||
| 166 | // See https://en.wikipedia.org/wiki/List_of_HTTP_header_fields |
|
| 167 | // See https://support.microsoft.com/en-us/kb/307347 |
|
| 168 | $headerOverride = false; |
|
| 169 | if(TRUSTED_PROXY) { |
|
| 170 | $headers = (defined('SS_TRUSTED_PROXY_PROTOCOL_HEADER')) ? array(SS_TRUSTED_PROXY_PROTOCOL_HEADER) : null; |
|
| 171 | if(!$headers) { |
|
| 172 | // Backwards compatible defaults |
|
| 173 | $headers = array('HTTP_X_FORWARDED_PROTO', 'HTTP_X_FORWARDED_PROTOCOL', 'HTTP_FRONT_END_HTTPS'); |
|
| 174 | } |
|
| 175 | foreach($headers as $header) { |
|
| 176 | $headerCompareVal = ($header === 'HTTP_FRONT_END_HTTPS' ? 'on' : 'https'); |
|
| 177 | if(!empty($_SERVER[$header]) && strtolower($_SERVER[$header]) == $headerCompareVal) { |
|
| 178 | $headerOverride = true; |
|
| 179 | break; |
|
| 180 | } |
|
| 181 | } |
|
| 182 | } |
|
| 183 | ||
| 184 | if($headerOverride) { |
|
| 185 | $proto = 'https'; |
|
| @@ 590-603 (lines=14) @@ | ||
| 587 | // See https://en.wikipedia.org/wiki/List_of_HTTP_header_fields |
|
| 588 | // See https://support.microsoft.com/en-us/kb/307347 |
|
| 589 | $headerOverride = false; |
|
| 590 | if (TRUSTED_PROXY) { |
|
| 591 | $headers = (defined('SS_TRUSTED_PROXY_PROTOCOL_HEADER')) ? array(SS_TRUSTED_PROXY_PROTOCOL_HEADER) : null; |
|
| 592 | if (!$headers) { |
|
| 593 | // Backwards compatible defaults |
|
| 594 | $headers = array('HTTP_X_FORWARDED_PROTO', 'HTTP_X_FORWARDED_PROTOCOL', 'HTTP_FRONT_END_HTTPS'); |
|
| 595 | } |
|
| 596 | foreach($headers as $header) { |
|
| 597 | $headerCompareVal = ($header === 'HTTP_FRONT_END_HTTPS' ? 'on' : 'https'); |
|
| 598 | if (!empty($_SERVER[$header]) && strtolower($_SERVER[$header]) == $headerCompareVal) { |
|
| 599 | $headerOverride = true; |
|
| 600 | break; |
|
| 601 | } |
|
| 602 | } |
|
| 603 | } |
|
| 604 | ||
| 605 | if ($protocol = Config::inst()->get('Director', 'alternate_protocol')) { |
|
| 606 | return ($protocol == 'https'); |
|