From fb0f15839d1b27dafdb0b3800fc70b60ce751356 Mon Sep 17 00:00:00 2001
From: Sonia Zorba <sonia.zorba@inaf.it>
Date: Mon, 15 Nov 2021 11:52:52 +0100
Subject: [PATCH] Handled detection of http/https protocol also behind proxy

---
 classes/Locator.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/classes/Locator.php b/classes/Locator.php
index 37c2eec..d783178 100644
--- a/classes/Locator.php
+++ b/classes/Locator.php
@@ -27,7 +27,8 @@ class Locator {
     }
 
     public function getProtocol(): string {
-        return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? 'https://' : 'http://';
+        return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? 'https://' : (
+                isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ? $_SERVER['HTTP_X_FORWARDED_PROTO'] . '://' : 'http://');
     }
 
     public function getBasePath(): string {
-- 
GitLab