From c8adcbbd7a4d112875fef45ad6b6245af4d4dd7b Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 9 Jan 2022 14:05:25 +0800 Subject: [PATCH] add / at last, via SCF default link. --- index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.php b/index.php index 725de56..c9244e2 100644 --- a/index.php +++ b/index.php @@ -88,6 +88,9 @@ function main_handler($event, $context) $event = json_decode(json_encode($event), true); $context = json_decode(json_encode($context), true); printInput($event, $context); + if ( $event['requestContext']['serviceId'] === substr($event['headers']['host'], 0, strlen($event['requestContext']['serviceId'])) ) { + if ($event['path']==='/' . $context['function_name']) return output('add / at last.', 308, ['Location'=>'/'.$event['requestContext']['stage'].'/'.$context['function_name'].'/']); + } unset($_POST); unset($_GET); unset($_COOKIE);