From 207642abb3db6e76033b6742261c6ec9d6cf7cd1 Mon Sep 17 00:00:00 2001 From: Aydan Pirani <aydanpirani@gmail.com> Date: Sun, 14 Apr 2024 17:58:13 -0500 Subject: [PATCH] clean up regex --- src/middleware/cors-middleware.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/middleware/cors-middleware.ts b/src/middleware/cors-middleware.ts index bc9242a..a902a69 100644 --- a/src/middleware/cors-middleware.ts +++ b/src/middleware/cors-middleware.ts @@ -2,10 +2,9 @@ import cors from "cors"; // Allow CORS for Netlify deploy previews const allowedOrigins = ["https://reflectionsprojections.org"]; - // Function to check if the origin matches the deploy preview format function isNetlifyDeployPreview(origin: string) { - const regex = /^https:\/\/deploy-preview-\d+--rp2024\.netlify\.app\/$/; + const regex = new RegExp("deploy-preview-[0-9]*(--rp2024\.netlify\.app)(.*)") return regex.test(origin); }