PDA

View Full Version : HTTPS Check


mr_ego
08-26-2003, 09:07 AM
I need a script that checks if the user is currently running through the HTTPS protocol, and if its not, pass header information to redirect it to another address..


Any Ideas? I would prefer it if the script didnt rely on checking that the web address started with https://.

DaiWelsh
08-28-2003, 04:14 PM
I am not in a position to check right now if any or all of these are defined in a PHP/Apache environment, but on IIS/Cold Fusion the following server variables exist

HTTPS (values e.g. off/on)
SERVER_PORT (value e.g. 80)
SERVER_PORT_SECURE (value e.g. 0/1)

so check for these or similar on your server.

Edit: checked on PHP/Apache and

SERVER_PORT, SERVER_PROTOCOL

look like the best candidates.

HTH,

Dai