Added conitional in case HTTP_X_FORWARDED_SSL == 1.