diff --git a/api/src/app.ts b/api/src/app.ts index f898d86..35dfa9b 100644 --- a/api/src/app.ts +++ b/api/src/app.ts @@ -21,10 +21,12 @@ const { MODE, CORS, WHITELIST } = process.env if (MODE?.trim() !== 'server' || CORS?.trim() === 'enable') { const whiteList: string[] = [] WHITELIST?.split(' ')?.forEach((url) => { - if (url.startsWith('http')) whiteList.push(url) + if (url.startsWith('http')) + // removing trailing slash of URLs listing for CORS + whiteList.push(url.replace(/\/$/, '')) }) - console.log('All CORS Requests are enabled') + console.log('All CORS Requests are enabled for:', whiteList) app.use(cors({ credentials: true, origin: whiteList })) }