From cf71ed823e7e12503d4e09f8b5945ed5e1dd76fa Mon Sep 17 00:00:00 2001 From: Gordon Pedersen Date: Tue, 17 Oct 2023 11:19:29 +1100 Subject: [PATCH] Attempt to fix a CORS issue --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 70ba580..593aca5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,9 +19,10 @@ const server = Bun.serve({ // CORS route (for now, any domain has access) if(req.method === "OPTIONS") { const headers:any = { - 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Origin': req.headers.get('Origin') || '*', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, DELETE', 'Access-Control-Max-Age': '86400', + 'Access-Control-Allow-Credentials': true } let h if (h = req.headers.get('Access-Control-Request-Headers'))