From fc21407614101de5c2d34e70abe042e2cb3112bf Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 30 Oct 2017 19:50:45 +0000 Subject: [PATCH] route : Add proxy support git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3989 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- route.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/route.php b/route.php index 77f27c2..f3d9d7a 100644 --- a/route.php +++ b/route.php @@ -97,7 +97,10 @@ class route $this->baseURL = dirname ($_SERVER["SCRIPT_NAME"]); if (isset ($_SERVER["SERVER_NAME"])) $this->baseURL = "//".$_SERVER["SERVER_NAME"].$port.$this->baseURL; - if (isset ($_SERVER["HTTPS"])) + if (isset ($_SERVER["HTTPS"]) || + (isset ($_SERVER["HTTP_X_FORWARDED_PROTO"]) && + $_SERVER["HTTP_X_FORWARDED_PROTO"] === "https") + ) $this->baseURL = "https:".$this->baseURL; else $this->baseURL = "http:".$this->baseURL; @@ -174,7 +177,9 @@ class route $url = ""; if ($absolute === true) { - if (isset ($_SERVER["HTTPS"])) + if (isset ($_SERVER["HTTPS"]) || + isset ($_SERVER["HTTP_X_FORWARDED_PROTO"]) && + $_SERVER["HTTP_X_FORWARDED_PROTO"] === "https") $url = "https:"; else $url = "http:";