From 0c2db53ee8d41d05545b616da9aafa4667f99d26 Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Sun, 27 Oct 2024 14:11:53 +0100 Subject: [PATCH] Address PR Comments --- app/controllers/api/proxy.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/proxy.php b/app/controllers/api/proxy.php index 3411ebafd5..ada8d2453c 100644 --- a/app/controllers/api/proxy.php +++ b/app/controllers/api/proxy.php @@ -54,11 +54,12 @@ App::post('/v1/proxy/rules') $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); - if ($functionsDomain != '' && str_ends_with($domain, $functionsDomain)) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your functions domain or it\'s subdomain to specific resource. Please use different domain.'); - } - if ($sitesDomain != '' && str_ends_with($domain, $sitesDomain)) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your sites domain or it\'s subdomain to specific resource. Please use different domain.'); + if ( + ($functionsDomain !== '' && str_ends_with($domain, $functionsDomain)) || + ($sitesDomain !== '' && str_ends_with($domain, $sitesDomain)) + ) { + // TODO: Refactor later + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your functions or sites domain or their subdomains to a specific resource. Please use a different domain.'); } if ($domain === 'localhost' || $domain === APP_HOSTNAME_INTERNAL) {