Check $_SERVER['HTTPS'] if empty will check server connection port
even better SSL check and define directory
Check first that $_SERVER['HTTPS'] isset

because some servers don't set $_SERVER['HTTPS'] if the connection is not secure
Check SSL fix
Merge pull request #34 from acidvertigo/patch-35

Check $_SERVER['HTTPS'] if empty will check server connection port