From 8b24c44fb9fcad2d120e5b5b65a27c5bb8b206cc Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:44:00 +0000 Subject: [PATCH] fix: proxy create rule 500 --- app/controllers/api/proxy.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/proxy.php b/app/controllers/api/proxy.php index f9621fb05a..0d1428cf23 100644 --- a/app/controllers/api/proxy.php +++ b/app/controllers/api/proxy.php @@ -87,8 +87,12 @@ App::post('/v1/proxy/rules') $resourceInternalId = $function->getInternalId(); } - $domain = new Domain($domain); - + try { + $domain = new Domain($domain); + } catch (Exception) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Invalid domain. Domain may not start with http:// or https://.'); + } + $ruleId = ID::unique(); $rule = new Document([ '$id' => $ruleId,