From 3a59661864d5ad3022a897fa98d13747a2764798 Mon Sep 17 00:00:00 2001 From: Tom Keller <1083460+kellertk@users.noreply.github.com> Date: Thu, 1 Aug 2024 10:04:17 -0700 Subject: [PATCH] fix: update cloudfront redirect --- cdkworkshop.com/cdkworkshop.com.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cdkworkshop.com/cdkworkshop.com.ts b/cdkworkshop.com/cdkworkshop.com.ts index 724b8cbe6..0ff39546e 100644 --- a/cdkworkshop.com/cdkworkshop.com.ts +++ b/cdkworkshop.com/cdkworkshop.com.ts @@ -102,11 +102,12 @@ export class CdkWorkshop extends Stack { runtime: cloudfront.FunctionRuntime.JS_2_0, code: cloudfront.FunctionCode.fromInline(` function handler(event) { + const request = event.request; const newUri = '${props.redirectTarget}'; return { - status: '302', - statusDescription: 'Found', - headers: {'Location': { value: newUri }}, + statusCode: 301, + statusDescription: 'Permanent Redirect', + headers: { location: { value: newUri } }, }; } `),