diff --git a/src/Appwrite/Platform/Modules/Console/Services/Http.php b/src/Appwrite/Platform/Modules/Console/Services/Http.php index 78b2835402..b0a41ca89d 100644 --- a/src/Appwrite/Platform/Modules/Console/Services/Http.php +++ b/src/Appwrite/Platform/Modules/Console/Services/Http.php @@ -20,6 +20,7 @@ use Appwrite\Platform\Modules\Console\Http\Scopes\Project\XList as ListKeyScopes use Appwrite\Platform\Modules\Console\Http\Templates\Email\Get as GetEmailTemplate; use Appwrite\Platform\Modules\Console\Http\Variables\Get as GetVariables; use Utopia\Platform\Service; +use Utopia\System\System; class Http extends Service { @@ -39,14 +40,16 @@ class Http extends Service $this->addAction(CreateAssistantQuery::getName(), new CreateAssistantQuery()); $this->addAction(GetResourceAvailability::getName(), new GetResourceAvailability()); - // web redirects to /console - $this->addAction(RedirectRoot::getName(), new RedirectRoot()); - $this->addAction(RedirectAuth::getName(), new RedirectAuth()); - $this->addAction(RedirectInvite::getName(), new RedirectInvite()); - $this->addAction(RedirectLogin::getName(), new RedirectLogin()); - $this->addAction(RedirectMFA::getName(), new RedirectMFA()); - $this->addAction(RedirectCard::getName(), new RedirectCard()); - $this->addAction(RedirectRecover::getName(), new RedirectRecover()); - $this->addAction(RedirectRegister::getName(), new RedirectRegister()); + // web redirects to /console; root-scheme consoles serve these paths themselves + if (System::getEnv('_APP_CONSOLE_URL_SCHEME', 'legacy') !== 'root') { + $this->addAction(RedirectRoot::getName(), new RedirectRoot()); + $this->addAction(RedirectAuth::getName(), new RedirectAuth()); + $this->addAction(RedirectInvite::getName(), new RedirectInvite()); + $this->addAction(RedirectLogin::getName(), new RedirectLogin()); + $this->addAction(RedirectMFA::getName(), new RedirectMFA()); + $this->addAction(RedirectCard::getName(), new RedirectCard()); + $this->addAction(RedirectRecover::getName(), new RedirectRecover()); + $this->addAction(RedirectRegister::getName(), new RedirectRegister()); + } } } diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index 42d49bbabc..ecbd88f822 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -9,6 +9,7 @@ use Tests\E2E\Scopes\ProjectNone; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideNone; use Utopia\Config\Config; +use Utopia\System\System; final class HTTPTest extends Scope { @@ -241,7 +242,8 @@ final class HTTPTest extends Scope $response = $this->client->call(Client::METHOD_GET, $endpoint, [], [], true, false); - $this->assertEquals('/console' . $endpoint, $response['headers']['location']); + $location = System::getEnv('_APP_CONSOLE_URL_SCHEME', 'legacy') !== 'root' ? '/console' . $endpoint : null; + $this->assertEquals($location, $response['headers']['location'] ?? null); } public function testConsoleServed()