From f835f332703c2229b68c6778443a0fa76ff3e3d8 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 26 Aug 2020 12:01:36 +0200 Subject: [PATCH] detect HTTPS from proxies Signed-off-by: Arthur Schiwon --- proxy.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy.php b/proxy.php index 11f20be..33f32f6 100644 --- a/proxy.php +++ b/proxy.php @@ -237,7 +237,10 @@ function getallheaders() exit(); } // URL into this server of the proxy script. -if (isset($_SERVER['HTTPS'])) { +if ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') + || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) + || (isset($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] === 'on') +) { $proxyURL = "https://"; } else { $proxyURL = "http://";