Skip to content

Commit

Permalink
Merge pull request #20 from ReflectionsProjections/dev/aydan/cors
Browse files Browse the repository at this point in the history
Dev/aydan/cors
  • Loading branch information
AydanPirani authored Apr 14, 2024
2 parents 5da0b04 + df0af0e commit d3c599b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/middleware/cors-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit d3c599b

Please sign in to comment.