From 710b8bda565c411ecb23e8b670d0ba7f45d2b3f3 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Thu, 12 Jun 2025 17:27:21 +0530 Subject: [PATCH 01/10] Use _APP_CONSOLE_DOMAIN, if not found, then use _APP_DOMAIN --- app/config/templates/site.php | 2 +- app/controllers/api/console.php | 4 ++-- app/controllers/general.php | 10 +++++----- app/views/general/error.phtml | 2 +- .../Modules/Functions/Http/Executions/Create.php | 2 +- .../Platform/Modules/Functions/Workers/Builds.php | 4 ++-- .../Platform/Modules/Proxy/Http/Rules/API/Create.php | 2 +- .../Modules/Proxy/Http/Rules/Function/Create.php | 2 +- .../Modules/Proxy/Http/Rules/Redirect/Create.php | 2 +- .../Platform/Modules/Proxy/Http/Rules/Site/Create.php | 2 +- src/Appwrite/Platform/Workers/Functions.php | 2 +- src/Appwrite/Vcs/Comment.php | 4 ++-- src/Executor/Executor.php | 2 +- .../e2e/Services/Projects/ProjectsCustomServerTest.php | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/config/templates/site.php b/app/config/templates/site.php index a853955a97..725e6fa918 100644 --- a/app/config/templates/site.php +++ b/app/config/templates/site.php @@ -7,7 +7,7 @@ use Utopia\System\System; */ $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; -$hostname = System::getEnv('_APP_DOMAIN'); +$hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); // TODO: Development override if (System::getEnv('_APP_ENV') === 'development') { diff --git a/app/controllers/api/console.php b/app/controllers/api/console.php index 558dc0e4ef..d78924028c 100644 --- a/app/controllers/api/console.php +++ b/app/controllers/api/console.php @@ -43,8 +43,8 @@ App::get('/v1/console/variables') )) ->inject('response') ->action(function (Response $response) { - $validator = new Domain(System::getEnv('_APP_DOMAIN')); - $isDomainValid = !empty(System::getEnv('_APP_DOMAIN', '')) && $validator->isKnown() && !$validator->isTest(); + $validator = new Domain(System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', ''))); + $isDomainValid = !empty(System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', ''))) && $validator->isKnown() && !$validator->isTest(); $validator = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME')); $isCNAMEValid = !empty(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')) && $validator->isKnown() && !$validator->isTest(); diff --git a/app/controllers/general.php b/app/controllers/general.php index 5beac9e1e8..632c735133 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -76,7 +76,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } $errorView = __DIR__ . '/../views/general/error.phtml'; - $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . '://' . System::getEnv('_APP_DOMAIN', ''); + $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . '://' . System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); if ($rule->isEmpty()) { $appDomainFunctionsFallback = System::getEnv('_APP_DOMAIN_FUNCTIONS_FALLBACK', ''); @@ -262,7 +262,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } if (!$authorized) { - $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . "://" . System::getEnv('_APP_DOMAIN'); + $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . "://" . System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $response ->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') ->addHeader('Pragma', 'no-cache') @@ -448,7 +448,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_DOMAIN'); + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $endpoint = $protocol . '://' . $hostname . "/v1"; // Appwrite vars @@ -809,7 +809,7 @@ App::init() * Appwrite Router */ $host = $request->getHostname() ?? ''; - $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); // Only run Router when external domain if ($host !== $mainDomain || !empty($previewHostname)) { if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { @@ -858,7 +858,7 @@ App::init() } else { Authorization::disable(); - $envDomain = System::getEnv('_APP_DOMAIN', ''); + $envDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $mainDomain = null; if (!empty($envDomain) && $envDomain !== 'localhost') { $mainDomain = $envDomain; diff --git a/app/views/general/error.phtml b/app/views/general/error.phtml index a427f1d5e8..de859a9c86 100644 --- a/app/views/general/error.phtml +++ b/app/views/general/error.phtml @@ -15,7 +15,7 @@ $labelClass = ''; $buttons = []; $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; -$hostname = System::getEnv('_APP_DOMAIN'); +$hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); // TODO: remove this later if (System::getEnv('_APP_ENV') === 'development') { $hostname = 'localhost'; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index fd1b2076a8..7838826136 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -351,7 +351,7 @@ class Create extends Base } $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_DOMAIN'); + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $endpoint = $protocol . '://' . $hostname . "/v1"; // Appwrite vars diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 399a4d5c44..263d67f000 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -594,7 +594,7 @@ class Builds extends Action ]); $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_DOMAIN'); + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $endpoint = $protocol . '://' . $hostname . "/v1"; // Appwrite vars @@ -1441,7 +1441,7 @@ class Builds extends Action $name = "{$resourceName} ({$projectName})"; $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_DOMAIN'); + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $projectId = $project->getId(); $resourceId = $resource->getId(); diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php index e4d0d2899f..a4d4980384 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php @@ -76,7 +76,7 @@ class Create extends Action APP_HOSTNAME_INTERNAL ]; - $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $deniedDomains[] = $mainDomain; $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php index 6c5a87a68d..66465a0a97 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -81,7 +81,7 @@ class Create extends Action APP_HOSTNAME_INTERNAL ]; - $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $deniedDomains[] = $mainDomain; $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index 3396a9c6fd..66a186993c 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -84,7 +84,7 @@ class Create extends Action APP_HOSTNAME_INTERNAL ]; - $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $deniedDomains[] = $mainDomain; $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php index 894c954a32..b466b1774b 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -81,7 +81,7 @@ class Create extends Action APP_HOSTNAME_INTERNAL ]; - $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $deniedDomains[] = $mainDomain; $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index c8c68a58ba..cf815198fa 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -484,7 +484,7 @@ class Functions extends Action } $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_DOMAIN'); + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $endpoint = $protocol . '://' . $hostname . "/v1"; // Appwrite vars diff --git a/src/Appwrite/Vcs/Comment.php b/src/Appwrite/Vcs/Comment.php index 5f528e660f..5b303efe44 100644 --- a/src/Appwrite/Vcs/Comment.php +++ b/src/Appwrite/Vcs/Comment.php @@ -87,7 +87,7 @@ class Comment $i = 0; foreach ($projects as $projectId => $project) { $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN')); + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $text .= "## {$project['name']}\n\n"; $text .= "Project ID: `{$projectId}`\n\n"; @@ -201,7 +201,7 @@ class Comment public function generatImage(string $pathLight, string $pathDark, string $alt, int $width): string { $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN')); + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $imageLight = $protocol . '://' . $hostname . $pathLight; $imageDark = $protocol . '://' . $hostname . $pathDark; diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index 5b204c1910..955f3851fa 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -200,7 +200,7 @@ class Executor int $requestTimeout = null ) { if (empty($headers['host'])) { - $headers['host'] = System::getEnv('_APP_DOMAIN', ''); + $headers['host'] = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); } $runtimeId = "$projectId-$deploymentId"; diff --git a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php index a01073f3a3..9146d0636f 100644 --- a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php +++ b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php @@ -83,7 +83,7 @@ class ProjectsCustomServerTest extends Scope $this->assertEquals(400, $response['headers']['status-code']); - $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); From cee6420fa2e5545e4e9302d1daf9809477c1a211 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Fri, 13 Jun 2025 15:50:53 +0530 Subject: [PATCH 02/10] Use env vars instead of request --- .env | 1 + app/config/templates/site.php | 5 ----- app/controllers/api/vcs.php | 16 +++++++++++----- app/controllers/general.php | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.env b/.env index b7dd9e24f3..42c23ac87f 100644 --- a/.env +++ b/.env @@ -22,6 +22,7 @@ _APP_OPTIONS_FORCE_HTTPS=disabled _APP_OPTIONS_ROUTER_FORCE_HTTPS=disabled _APP_OPENSSL_KEY_V1=your-secret-key _APP_DOMAIN=traefik +_APP_CONSOLE_DOMAIN=localhost _APP_DOMAIN_FUNCTIONS=functions.localhost _APP_DOMAIN_SITES=sites.localhost _APP_DOMAIN_TARGET_CNAME=test.localhost diff --git a/app/config/templates/site.php b/app/config/templates/site.php index 725e6fa918..47a436b44e 100644 --- a/app/config/templates/site.php +++ b/app/config/templates/site.php @@ -9,11 +9,6 @@ use Utopia\System\System; $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); -// TODO: Development override -if (System::getEnv('_APP_ENV') === 'development') { - $hostname = 'localhost'; -} - $url = $protocol . '://' . $hostname; class UseCases diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 79050c2913..a7f8ee7718 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -116,8 +116,10 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId } $commentStatus = $isAuthorized ? 'waiting' : 'failed'; + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); - $authorizeUrl = $request->getProtocol() . '://' . $request->getHostname() . "/console/git/authorize-contributor?projectId={$projectId}&installationId={$installationId}&repositoryId={$repositoryId}&providerPullRequestId={$providerPullRequestId}"; + $authorizeUrl = $protocol . '://' . $hostname . "/console/git/authorize-contributor?projectId={$projectId}&installationId={$installationId}&repositoryId={$repositoryId}&providerPullRequestId={$providerPullRequestId}"; $action = $isAuthorized ? ['type' => 'logs'] : ['type' => 'authorize', 'url' => $authorizeUrl]; @@ -378,7 +380,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId } $owner = $github->getOwnerName($providerInstallationId); - $providerTargetUrl = $request->getProtocol() . '://' . $request->getHostname() . "/console/project-$region-$projectId/$resourceCollection/$resourceType-$resourceId"; + $providerTargetUrl = $protocol . '://' . $hostname . "/console/project-$region-$projectId/$resourceCollection/$resourceType-$resourceId"; $github->updateCommitStatus($repositoryName, $providerCommitHash, $owner, 'pending', $message, $providerTargetUrl, $name); } @@ -437,6 +439,8 @@ App::get('/v1/vcs/github/authorize') ]); $appName = System::getEnv('_APP_VCS_GITHUB_APP_NAME'); + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); if (empty($appName)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'GitHub App name is not configured. Please configure VCS (Version Control System) variables in .env file.'); @@ -444,7 +448,7 @@ App::get('/v1/vcs/github/authorize') $url = "https://github.com/apps/$appName/installations/new?" . \http_build_query([ 'state' => $state, - 'redirect_uri' => $request->getProtocol() . '://' . $request->getHostname() . "/v1/vcs/github/callback" + 'redirect_uri' => $protocol . '://' . $hostname . "/v1/vcs/github/callback" ]); $response @@ -494,10 +498,12 @@ App::get('/v1/vcs/github/callback') } $region = $project->getAttribute('region', 'default'); + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $defaultState = [ - 'success' => $request->getProtocol() . '://' . $request->getHostname() . "/console/project-$region-$projectId/settings/git-installations", - 'failure' => $request->getProtocol() . '://' . $request->getHostname() . "/console/project-$region-$projectId/settings/git-installations", + 'success' => $protocol . '://' . $hostname . "/console/project-$region-$projectId/settings/git-installations", + 'failure' => $protocol . '://' . $hostname . "/console/project-$region-$projectId/settings/git-installations", ]; $state = \array_merge($defaultState, $state ?? []); diff --git a/app/controllers/general.php b/app/controllers/general.php index 724e69f61f..858ac2c4c3 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -810,7 +810,7 @@ App::init() * Appwrite Router */ $host = $request->getHostname() ?? ''; - $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $mainDomain = System::getEnv('_APP_DOMAIN', ''); // Only run Router when external domain if ($host !== $mainDomain || !empty($previewHostname)) { if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { From 5e345c0388ca45826c7a6dfe26f0eeb9797ca963 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Mon, 16 Jun 2025 17:29:01 +0530 Subject: [PATCH 03/10] Revert some changes --- app/controllers/api/console.php | 4 ++-- app/controllers/general.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/console.php b/app/controllers/api/console.php index d78924028c..558dc0e4ef 100644 --- a/app/controllers/api/console.php +++ b/app/controllers/api/console.php @@ -43,8 +43,8 @@ App::get('/v1/console/variables') )) ->inject('response') ->action(function (Response $response) { - $validator = new Domain(System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', ''))); - $isDomainValid = !empty(System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', ''))) && $validator->isKnown() && !$validator->isTest(); + $validator = new Domain(System::getEnv('_APP_DOMAIN')); + $isDomainValid = !empty(System::getEnv('_APP_DOMAIN', '')) && $validator->isKnown() && !$validator->isTest(); $validator = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME')); $isCNAMEValid = !empty(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')) && $validator->isKnown() && !$validator->isTest(); diff --git a/app/controllers/general.php b/app/controllers/general.php index c4e5f3d55e..69912a9cb9 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -76,7 +76,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } $errorView = __DIR__ . '/../views/general/error.phtml'; - $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . '://' . System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . '://' . System::getEnv('_APP_DOMAIN', ''); if ($rule->isEmpty()) { $appDomainFunctionsFallback = System::getEnv('_APP_DOMAIN_FUNCTIONS_FALLBACK', ''); @@ -262,7 +262,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } if (!$authorized) { - $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . "://" . System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . "://" . System::getEnv('_APP_DOMAIN'); $response ->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') ->addHeader('Pragma', 'no-cache') @@ -449,7 +449,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $hostname = System::getEnv('_APP_DOMAIN'); $endpoint = $protocol . '://' . $hostname . "/v1"; // Appwrite vars @@ -858,7 +858,7 @@ App::init() } else { Authorization::disable(); - $envDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $envDomain = System::getEnv('_APP_DOMAIN', ''); $mainDomain = null; if (!empty($envDomain) && $envDomain !== 'localhost') { $mainDomain = $envDomain; From 8c8abfdecebbf3cfc9e6978ab3ca76569bd9f8e5 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Mon, 16 Jun 2025 18:47:50 +0530 Subject: [PATCH 04/10] Add var_dumps to debug --- app/controllers/general.php | 2 +- src/Appwrite/Vcs/Comment.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 69912a9cb9..1761e16881 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -262,7 +262,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } if (!$authorized) { - $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . "://" . System::getEnv('_APP_DOMAIN'); + $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . "://" . System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $response ->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') ->addHeader('Pragma', 'no-cache') diff --git a/src/Appwrite/Vcs/Comment.php b/src/Appwrite/Vcs/Comment.php index 5b303efe44..96cbd9662d 100644 --- a/src/Appwrite/Vcs/Comment.php +++ b/src/Appwrite/Vcs/Comment.php @@ -88,6 +88,7 @@ class Comment foreach ($projects as $projectId => $project) { $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + var_dump("hostname: $hostname"); $text .= "## {$project['name']}\n\n"; $text .= "Project ID: `{$projectId}`\n\n"; @@ -166,6 +167,8 @@ class Comment }; if ($function['action']['type'] === 'logs') { + var_dump("in view logs"); + var_dump("hostname: $hostname"); $action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $function['region'] . '-' . $projectId . '/functions/function-' . $functionId . '/deployment-' . $function['deploymentId'] . ')'; } else { $action = '[Authorize](' . $function['action']['url'] . ')'; From ad60ff99728d720957a82e6e846b0c72854e7715 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Mon, 16 Jun 2025 19:16:20 +0530 Subject: [PATCH 05/10] Update url in general.php --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 1761e16881..12b3c5d773 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -76,7 +76,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw } $errorView = __DIR__ . '/../views/general/error.phtml'; - $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . '://' . System::getEnv('_APP_DOMAIN', ''); + $url = (System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https') . '://' . System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); if ($rule->isEmpty()) { $appDomainFunctionsFallback = System::getEnv('_APP_DOMAIN_FUNCTIONS_FALLBACK', ''); From 41bc8272ff30d3717154d8d1f6641306415c4086 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Tue, 17 Jun 2025 12:15:52 +0530 Subject: [PATCH 06/10] Add env var to docker-compose --- docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 0b653af8c2..72006a10a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -116,6 +116,7 @@ services: - _APP_OPTIONS_ROUTER_FORCE_HTTPS - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN + - _APP_CONSOLE_DOMAIN - _APP_DOMAIN_TARGET_CNAME - _APP_DOMAIN_TARGET_AAAA - _APP_DOMAIN_TARGET_A @@ -481,6 +482,7 @@ services: - _APP_OPTIONS_FORCE_HTTPS - _APP_OPTIONS_ROUTER_FORCE_HTTPS - _APP_DOMAIN + - _APP_CONSOLE_DOMAIN - _APP_STORAGE_DEVICE - _APP_STORAGE_S3_ACCESS_KEY - _APP_STORAGE_S3_SECRET @@ -564,6 +566,7 @@ services: - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN + - _APP_CONSOLE_DOMAIN - _APP_OPTIONS_FORCE_HTTPS - _APP_REDIS_HOST - _APP_REDIS_PORT From b7ffd2ca94ea6655c90026a0255cc87290610306 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Tue, 17 Jun 2025 13:57:21 +0530 Subject: [PATCH 07/10] Revert some changes --- docker-compose.yml | 1 - .../Platform/Modules/Functions/Http/Executions/Create.php | 2 +- src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php | 2 +- .../Platform/Modules/Proxy/Http/Rules/Function/Create.php | 2 +- .../Platform/Modules/Proxy/Http/Rules/Redirect/Create.php | 2 +- src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php | 2 +- src/Appwrite/Platform/Workers/Functions.php | 2 +- src/Appwrite/Vcs/Comment.php | 3 --- src/Executor/Executor.php | 2 +- tests/e2e/Services/Projects/ProjectsCustomServerTest.php | 2 +- 10 files changed, 8 insertions(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 72006a10a6..56f8f38f44 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -566,7 +566,6 @@ services: - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN - - _APP_CONSOLE_DOMAIN - _APP_OPTIONS_FORCE_HTTPS - _APP_REDIS_HOST - _APP_REDIS_PORT diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 2f7c84b7d1..71ff730b98 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -351,7 +351,7 @@ class Create extends Base } $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $hostname = System::getEnv('_APP_DOMAIN'); $endpoint = $protocol . '://' . $hostname . "/v1"; // Appwrite vars diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php index a4d4980384..e4d0d2899f 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php @@ -76,7 +76,7 @@ class Create extends Action APP_HOSTNAME_INTERNAL ]; - $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $mainDomain = System::getEnv('_APP_DOMAIN', ''); $deniedDomains[] = $mainDomain; $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php index 66465a0a97..6c5a87a68d 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -81,7 +81,7 @@ class Create extends Action APP_HOSTNAME_INTERNAL ]; - $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $mainDomain = System::getEnv('_APP_DOMAIN', ''); $deniedDomains[] = $mainDomain; $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index 66a186993c..3396a9c6fd 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -84,7 +84,7 @@ class Create extends Action APP_HOSTNAME_INTERNAL ]; - $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $mainDomain = System::getEnv('_APP_DOMAIN', ''); $deniedDomains[] = $mainDomain; $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php index b466b1774b..894c954a32 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -81,7 +81,7 @@ class Create extends Action APP_HOSTNAME_INTERNAL ]; - $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $mainDomain = System::getEnv('_APP_DOMAIN', ''); $deniedDomains[] = $mainDomain; $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 6dde173843..843cb4a5b9 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -484,7 +484,7 @@ class Functions extends Action } $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $hostname = System::getEnv('_APP_DOMAIN'); $endpoint = $protocol . '://' . $hostname . "/v1"; // Appwrite vars diff --git a/src/Appwrite/Vcs/Comment.php b/src/Appwrite/Vcs/Comment.php index 96cbd9662d..5b303efe44 100644 --- a/src/Appwrite/Vcs/Comment.php +++ b/src/Appwrite/Vcs/Comment.php @@ -88,7 +88,6 @@ class Comment foreach ($projects as $projectId => $project) { $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); - var_dump("hostname: $hostname"); $text .= "## {$project['name']}\n\n"; $text .= "Project ID: `{$projectId}`\n\n"; @@ -167,8 +166,6 @@ class Comment }; if ($function['action']['type'] === 'logs') { - var_dump("in view logs"); - var_dump("hostname: $hostname"); $action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $function['region'] . '-' . $projectId . '/functions/function-' . $functionId . '/deployment-' . $function['deploymentId'] . ')'; } else { $action = '[Authorize](' . $function['action']['url'] . ')'; diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index 8ead1c82a2..15411f18ab 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -191,7 +191,7 @@ class Executor int $requestTimeout = null ) { if (empty($headers['host'])) { - $headers['host'] = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $headers['host'] = System::getEnv('_APP_DOMAIN', ''); } $runtimeId = "$projectId-$deploymentId"; diff --git a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php index 9146d0636f..a01073f3a3 100644 --- a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php +++ b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php @@ -83,7 +83,7 @@ class ProjectsCustomServerTest extends Scope $this->assertEquals(400, $response['headers']['status-code']); - $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $mainDomain = System::getEnv('_APP_DOMAIN', ''); $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); From 22cda269b18c4cd40abbaf53f19254135e0ed8b6 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Tue, 17 Jun 2025 18:37:02 +0530 Subject: [PATCH 08/10] Update console --- composer.lock | 39 +++++++++++++++++++-------------------- docker-compose.yml | 2 +- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/composer.lock b/composer.lock index fdde3f2750..c60ba97f8b 100644 --- a/composer.lock +++ b/composer.lock @@ -1874,16 +1874,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.43", + "version": "3.0.44", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "709ec107af3cb2f385b9617be72af8cf62441d02" + "reference": "1d0b5e7e1434678411787c5a0535e68907cf82d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02", - "reference": "709ec107af3cb2f385b9617be72af8cf62441d02", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/1d0b5e7e1434678411787c5a0535e68907cf82d9", + "reference": "1d0b5e7e1434678411787c5a0535e68907cf82d9", "shasum": "" }, "require": { @@ -1964,7 +1964,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.43" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.44" }, "funding": [ { @@ -1980,7 +1980,7 @@ "type": "tidelift" } ], - "time": "2024-12-14T21:12:59+00:00" + "time": "2025-06-15T09:59:26+00:00" }, { "name": "psr/container", @@ -4807,16 +4807,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.41.4", + "version": "0.41.7", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "07804269131f411576aac60c795a5ebc3afaa48a" + "reference": "d8c7bb26ea32ab378faf4e0dfa62fd15fe37c57b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/07804269131f411576aac60c795a5ebc3afaa48a", - "reference": "07804269131f411576aac60c795a5ebc3afaa48a", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d8c7bb26ea32ab378faf4e0dfa62fd15fe37c57b", + "reference": "d8c7bb26ea32ab378faf4e0dfa62fd15fe37c57b", "shasum": "" }, "require": { @@ -4852,9 +4852,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.41.4" + "source": "https://github.com/appwrite/sdk-generator/tree/0.41.7" }, - "time": "2025-06-10T08:28:11+00:00" + "time": "2025-06-13T17:05:57+00:00" }, { "name": "doctrine/annotations", @@ -5147,16 +5147,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.73", + "version": "1.3.74", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "cb7a9297b4ab070909cefade30ee95054d4ae87a" + "reference": "a2593286a4135d03c6a6a9e9aeded5d41e931ce4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/cb7a9297b4ab070909cefade30ee95054d4ae87a", - "reference": "cb7a9297b4ab070909cefade30ee95054d4ae87a", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/a2593286a4135d03c6a6a9e9aeded5d41e931ce4", + "reference": "a2593286a4135d03c6a6a9e9aeded5d41e931ce4", "shasum": "" }, "require": { @@ -5167,8 +5167,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": ">=2.0", "matthiasmullie/scrapbook": ">=1.3", - "phpunit/phpunit": ">=4.8", - "squizlabs/php_codesniffer": ">=3.0" + "phpunit/phpunit": ">=4.8" }, "suggest": { "psr/cache-implementation": "Cache implementation to use with Minify::cache" @@ -5206,7 +5205,7 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.73" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.74" }, "funding": [ { @@ -5214,7 +5213,7 @@ "type": "github" } ], - "time": "2024-03-15T10:27:10+00:00" + "time": "2025-06-12T08:06:04+00:00" }, { "name": "matthiasmullie/path-converter", diff --git a/docker-compose.yml b/docker-compose.yml index 56f8f38f44..749613c8c6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -214,7 +214,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:6.0.41 + image: appwrite/console:6.1.2 restart: unless-stopped networks: - appwrite From 5a3e44a36d570c0d3b0e8b54314e0549c637eadf Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 18 Jun 2025 11:06:35 +0530 Subject: [PATCH 09/10] Replace == with === --- app/config/templates/site.php | 2 +- app/controllers/api/vcs.php | 6 +++--- app/controllers/general.php | 2 +- src/Appwrite/Vcs/Comment.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/config/templates/site.php b/app/config/templates/site.php index 47a436b44e..c6f0119ed9 100644 --- a/app/config/templates/site.php +++ b/app/config/templates/site.php @@ -6,7 +6,7 @@ use Utopia\System\System; * List of Appwrite Sites templates */ -$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; +$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $url = $protocol . '://' . $hostname; diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 2568925c43..12d3980f7c 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -116,7 +116,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId } $commentStatus = $isAuthorized ? 'waiting' : 'failed'; - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $authorizeUrl = $protocol . '://' . $hostname . "/console/git/authorize-contributor?projectId={$projectId}&installationId={$installationId}&repositoryId={$repositoryId}&providerPullRequestId={$providerPullRequestId}"; @@ -439,7 +439,7 @@ App::get('/v1/vcs/github/authorize') ]); $appName = System::getEnv('_APP_VCS_GITHUB_APP_NAME'); - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); if (empty($appName)) { @@ -498,7 +498,7 @@ App::get('/v1/vcs/github/callback') } $region = $project->getAttribute('region', 'default'); - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $defaultState = [ diff --git a/app/controllers/general.php b/app/controllers/general.php index 12b3c5d773..97d90ebea9 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -448,7 +448,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw $vars[$var->getAttribute('key')] = $var->getAttribute('value', ''); } - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_DOMAIN'); $endpoint = $protocol . '://' . $hostname . "/v1"; diff --git a/src/Appwrite/Vcs/Comment.php b/src/Appwrite/Vcs/Comment.php index 5b303efe44..a66706a4a2 100644 --- a/src/Appwrite/Vcs/Comment.php +++ b/src/Appwrite/Vcs/Comment.php @@ -86,7 +86,7 @@ class Comment $i = 0; foreach ($projects as $projectId => $project) { - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $text .= "## {$project['name']}\n\n"; @@ -200,7 +200,7 @@ class Comment public function generatImage(string $pathLight, string $pathDark, string $alt, int $width): string { - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); $imageLight = $protocol . '://' . $hostname . $pathLight; From 0f37a0e0efb292fece58b60957e2f1a8265eb3fa Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Thu, 3 Jul 2025 00:08:29 +0530 Subject: [PATCH 10/10] Fix tests --- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 3221383d70..25b3473829 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -594,7 +594,7 @@ class Builds extends Action ]); $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $hostname = System::getEnv('_APP_DOMAIN'); $endpoint = $protocol . '://' . $hostname . "/v1"; // Appwrite vars