Skip to content

Commit 5c70690

Browse files
committed
web: add function to redirect Grind 75 path
1 parent a45315e commit 5c70690

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

apps/website/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717

1818
npm-debug.log*
1919
yarn-debug.log*
20-
yarn-error.log*
20+
yarn-error.log*
21+
22+
# cloudflare
23+
.wrangler
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const SOURCE_HOST = 'https://grind75.vercel.app';
2+
3+
export async function onRequest(context) {
4+
const { request } = context;
5+
// Define the original and target paths
6+
const url = new URL(request.url);
7+
8+
// Rewrite to the new domain, preserving the original path and query string
9+
const newURL = SOURCE_HOST + url.pathname + url.search;
10+
11+
// Fetch the content from the new domain
12+
return await fetch(newURL, request);
13+
}

0 commit comments

Comments
 (0)