From 568a8a110d9949af4ccd80c2cee5f33b08cb878c Mon Sep 17 00:00:00 2001 From: Moritz Strohm Date: Mon, 23 Oct 2023 14:02:49 +0200 Subject: Request::path: remove trailing slash from REVERSE_PROXY_TARGET_URL --- lib/classes/Request.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/classes/Request.php b/lib/classes/Request.php index df0884a..3393567 100644 --- a/lib/classes/Request.php +++ b/lib/classes/Request.php @@ -144,6 +144,11 @@ class Request implements ArrayAccess, IteratorAggregate if (!empty($GLOBALS['REVERSE_PROXY_TARGET_URL'])) { //Only return the remainder of the path that is not part of REVERSE_PROXY_TARGET_URL. $reverse_proxy_target_path = parse_url($GLOBALS['REVERSE_PROXY_TARGET_URL'], PHP_URL_PATH); + if ($reverse_proxy_target_path[-1] === '/') { + //Remove the slash at the end since REQUEST_URI will contain one. + $reverse_proxy_target_path = mb_substr($reverse_proxy_target_path, 0, -1); + } + $remaining_path = substr($_SERVER['REQUEST_URI'], strlen($reverse_proxy_target_path)); if ($remaining_path[0] !== '/') { $remaining_path = '/' . $remaining_path; -- cgit v1.0