add https support with if (isset(['HTTPS']) && (strtolower(['HTTPS']) == 'on')) {
https support with HTTP_X_FORWARDED_PROTO