From 04eb60a4b9899cf8af42e1965449b552c6bf5716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20H=C3=B6rmann?= <537665+jhit@users.noreply.github.com> Date: Fri, 2 Sep 2022 19:53:17 +0200 Subject: [PATCH] Allow Proxy inside Subfolder I needed to run the proxy in a subfolder. The change will still allow the proxy to run in web root. The `RewriteRule` for Apache needs a little change in subfolder too: ``` RewriteRule ^(.*)$ /maps/public/index.php [L] ``` --- src/TileProxy.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TileProxy.php b/src/TileProxy.php index 1a40909..9b43712 100644 --- a/src/TileProxy.php +++ b/src/TileProxy.php @@ -219,6 +219,8 @@ private function validate($parts) public function handle() { $path_only = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); + $subfolder = dirname(parse_url($_SERVER['SCRIPT_NAME'], PHP_URL_PATH)); + $path_only = substr($path_only, strlen($subfolder)-1); $parts = explode("/", $path_only); if($this->validate($parts)) {