From be1c12147fa4d906bff4b09d0e875bf7f8e01fde Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 19 Feb 2025 22:59:04 +0200 Subject: [PATCH] debug --- app/controllers/general.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index abf4898938..2230c99e2c 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -88,19 +88,11 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'This domain is not connected to any Appwrite resource yet. Please configure custom domain or function domain to allow this request.'); } - var_dump([ - 'before' => $host - ]); -// -// if (System::getEnv('_APP_OPTIONS_ROUTER_PROTECTION', 'disabled') === 'enabled') { -// if ($host !== 'localhost' && $host !== APP_HOSTNAME_INTERNAL && $host !== System::getEnv('_APP_CONSOLE_DOMAIN', '')) { -// throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'Router protection does not allow accessing Appwrite over this domain. Please add it as custom domain to your project or disable _APP_OPTIONS_ROUTER_PROTECTION environment variable.'); -// } -// } - - var_dump([ - 'after' => $host - ]); + if (System::getEnv('_APP_OPTIONS_ROUTER_PROTECTION', 'disabled') === 'enabled') { + if ($host !== 'localhost' && $host !== APP_HOSTNAME_INTERNAL && $host !== System::getEnv('_APP_CONSOLE_DOMAIN', '')) { + throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'Router protection does not allow accessing Appwrite over this domain. Please add it as custom domain to your project or disable _APP_OPTIONS_ROUTER_PROTECTION environment variable.'); + } + } // Act as API - no Proxy logic $utopia->getRoute()?->label('error', ''); @@ -528,7 +520,6 @@ App::init() $host = $request->getHostname() ?? ''; $mainDomain = System::getEnv('_APP_DOMAIN', ''); - var_dump('Init Called'); // Only run Router when external domain if ($host !== $mainDomain || !empty($previewHostname)) {