Skip to content

Instantly share code, notes, and snippets.

@jacsonp
Created May 25, 2020 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacsonp/04cbce6d7465fb8fa8cde0dfd68dcaab to your computer and use it in GitHub Desktop.
Save jacsonp/04cbce6d7465fb8fa8cde0dfd68dcaab to your computer and use it in GitHub Desktop.
Really Simple SSL reverse proxy fix
//Begin Really Simple 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 Really Simple SSL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment