Skip to content

Commit

Permalink
add netlify whitelist preview
Browse files Browse the repository at this point in the history
  • Loading branch information
codingki committed Sep 27, 2024
1 parent 84cdea4 commit 4b5af9b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ const isVercelPreview = (str: string) => {
return false;
};

const isNetlifyPreview = (str: string) => {
if (str.endsWith("netlify.app")) {
return true;
}
return false;
};

const isCloudflarePreview = (str: string) => {
if (str.endsWith("pages.dev")) {
return true;
Expand All @@ -38,7 +45,7 @@ const isCloudflarePreview = (str: string) => {
};

const isPreview = (str: string) => {
if (isVercelPreview(str) || isCloudflarePreview(str)) {
if (isVercelPreview(str) || isCloudflarePreview(str) || isNetlifyPreview(str)) {
return true;
}
return false;
Expand Down

0 comments on commit 4b5af9b

Please sign in to comment.