Support - Knowledge base

Giving you the answers you need

Why not try our knowledge base for instant help and advice to enhance your online experience with Register365? From within the knowledge base you can browse our frequently asked questions and find the right answers to help solve your queries.

Home  >  Scripting  >  PHP (Hypertext Preprocessor)  >  View Article

How can I check I have a secure connection in my PHP scripts?

1*1*1*1*1*

Article

Usually, when establishing whether or not a script is running in a secure environment developers check that the connection port is 443 which is the normal port for SSL connections. On both the Linux and Windows clusters, SSL decryption is performed on the load balancers and not on the web servers directly, this results in a valid SSL connection over port 80.

The Zeus Load balancers are configured to add some extra headers to HTTPS requests so you can still determine with confidence whether the request was received over HTTPS or not. The best variable to use is $_SERVER["HTTP_SSLSESSIONID"].

This issue, may cause issues for customers using the Xcart ecommerce application because it always checks that the connection is over port 443 once you get to the checkout. However, there is a simple solution...

The ZXTMs are configured to add some extra headers to HTTPS requests so you can still determine with confidence whether the request was received over HTTPS or not. The best variable to use is $_SERVER["HTTP_SSLSESSIONID"].

So, to fix xcart, just comment out the following line near the top of include/https_detect.php

//$HTTPS = (stristr($HTTP_SERVER_VARS["HTTPS"], "on") || ($HTTP_SERVER_VARS["HTTPS"] == 1) || ($HTTP_SERVER_VARS["SERVER_PORT"] == 443));

... And add this...

$HTTPS = $_SERVER["HTTP_SSLSESSIONID"] ? TRUE : FALSE;

Rate This Article

How useful was this article?

Not useful A little useful Useful Very useful Everything I needed