From a7a1c884b2ccfdcf280046ed6972f6146bcf9755 Mon Sep 17 00:00:00 2001 From: Anda Toshiki <101481353+andatoshiki@users.noreply.github.com> Date: Thu, 9 May 2024 01:40:53 -0700 Subject: [PATCH] fix(allowed origin): add pre-assigned nelify address url to allowed origin list for test deployment rundown --- netlify/functions/getLastFmSongs.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netlify/functions/getLastFmSongs.ts b/netlify/functions/getLastFmSongs.ts index 7d49f87..2c9f48f 100755 --- a/netlify/functions/getLastFmSongs.ts +++ b/netlify/functions/getLastFmSongs.ts @@ -23,6 +23,13 @@ const handler: Handler = async () => { // Origin for CORS const origin = process.env.NODE_ENV === 'production' ? 'https://toshiki.dev' : 'http://localhost:3000' + const allowedOrigins = ['https://toshiki.dev', 'http://localhost:3000', 'https://toshiki-home-nuxt3.netlify.app/'] + if (!allowedOrigins.includes(origin)) { + return { + statusCode: 403, + body: 'Forbidden' + } + } // Map track function const mapTrack = (track: any): any => {