HosipLan

Untitled

Nov 4th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1.         // hack for https proxies
  2.         if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
  3.             if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' && isset($_SERVER['SERVER_PORT']) && in_array($_SERVER['SERVER_PORT'], [80, 82])) { // https over proxy
  4.                 $_SERVER['HTTPS'] = 'On';
  5.                 $_SERVER['SERVER_PORT'] = 443;
  6.  
  7.             } elseif ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'http' && isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 80) { // http over proxy
  8.                 $_SERVER['HTTPS'] = 'Off';
  9.                 $_SERVER['SERVER_PORT'] = 80;
  10.             }
  11.  
  12.         } elseif (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 81) { // spdy
  13.             $_SERVER['HTTPS'] = 'On';
  14.             $_SERVER['SERVER_PORT'] = 443;
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment