My cart goes into an infinite loop with SSL enabled?!
Solution SSL in CubeCart works by detecting if the current page is in SSL mode or not and if it needs to be.
If the current page is not in SSL mode and it needs to be CubeCart will redirect automatically to the secure page. Once it has redirected it will look again to make sure it is now in SSL mode.
In order for it to do this CubeCart needs to look for certain server environment value. The following function is in the CubeCart code to do this. It can be found in /includes/functions.inc.php
function detectSSL(){
if($_SERVER["HTTPS"] == "on"){
return TRUE;
} elseif ($_SERVER["HTTPS"] == 1){
return TRUE;
} elseif ($_SERVER['SERVER_PORT'] == 443) {
return TRUE;
} else {
return FALSE;
}
}
As a result of this the server has to broadcast either $_SERVER['SERVER_PORT'] or $_SERVER["HTTPS"] for CubeCart to work under SSL.
If your hosting environment doesn't do this then CubeCart will go into an infinite loop as it cant see when it is under SSL.
To check if your server broadcasts this please upload a file called sslcheck.php with the content:
echo "
";
print_r($_SERVER);
echo "
";
?>
This will list all the server environment variables available. Please run this script in both standard http or https protocol.
e.g.
http://www.example.com/sslcheck.php and
https://www.example.com/sslcheck.phpPlease compare the two. If neither of $_SERVER['SERVER_PORT'] or $_SERVER["HTTPS"] are present under SSL then CubeCart will not currently work with your hosting environment with SSL enabled.
Well, in my case it appears my host does indeed meet the requirements above since from the shared ssl url it broadcasts back both ' [HTTPS] => on ' and ' [SERVER_PORT] => 443 '.