Skip to content

Instantly share code, notes, and snippets.

@GreatPotato
Created March 5, 2012 15:52
Show Gist options
  • Save GreatPotato/1978941 to your computer and use it in GitHub Desktop.
Save GreatPotato/1978941 to your computer and use it in GitHub Desktop.
Cloud SSL Infinite Redirection
<?php
/**
* Cloud load balancer sets these for us so we know we're secure,
* preventing LemonStand from performing a redirect loop.
**/
if( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
{
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment