From 00dd77e93095c1bd54fbb05be89cb0f040feb4b9 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 22 Aug 2023 14:14:20 -0400 Subject: [PATCH] Fix exception condition --- app/controllers/api/proxy.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/proxy.php b/app/controllers/api/proxy.php index 8cc765c2ce..442bab740d 100644 --- a/app/controllers/api/proxy.php +++ b/app/controllers/api/proxy.php @@ -42,7 +42,10 @@ App::post('/v1/proxy/rules') ->inject('dbForProject') ->action(function (string $domain, string $resourceType, string $resourceId, Response $response, Document $project, Event $events, Database $dbForConsole, Database $dbForProject) { $mainDomain = App::getEnv('_APP_DOMAIN', ''); - if ($domain === $mainDomain || $domain === 'localhost' || $domain === APP_HOSTNAME_INTERNAL) { + if ($domain === $mainDomain) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your main domain to specific resource. Please use subdomain or a different domain.'); + } + if ($domain === 'localhost' || $domain === APP_HOSTNAME_INTERNAL) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please pick another one.'); }