Skip to content

Instantly share code, notes, and snippets.

@eduardopintor
Created December 3, 2018 15:40
Show Gist options
  • Select an option

  • Save eduardopintor/104e90a1268076403af3d572f90e70f2 to your computer and use it in GitHub Desktop.

Select an option

Save eduardopintor/104e90a1268076403af3d572f90e70f2 to your computer and use it in GitHub Desktop.
//Begin SSL Load balancing fix
$server_opts = array("HTTP_CLOUDFRONT_FORWARDED_PROTO" => "https", "HTTP_CF_VISITOR"=>"https", "HTTP_X_FORWARDED_PROTO"=>"https", "HTTP_X_FORWARDED_SSL"=>"on", "HTTP_X_PROTO"=>"SSL", "HTTP_X_FORWARDED_SSL"=>"1");
foreach( $server_opts as $option => $value ) {
if ((isset($_ENV["HTTPS"]) && ( "on" == $_ENV["HTTPS"] )) || (isset( $_SERVER[ $option ] ) && ( strpos( $_SERVER[ $option ], $value ) !== false )) ) {
$_SERVER[ "HTTPS" ] = "on";
break;
}
}
//END SSL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment