Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/doc 150/remove vercel redirects #1300

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1242956
remove vercel redirects
fmonper1 May 9, 2023
b3b14c7
add original url
fmonper1 May 11, 2023
c2252fa
add edge middleware
fmonper1 May 15, 2023
5ed0020
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 May 15, 2023
ca7ecd8
disable redirect to try out edge middleware
fmonper1 May 15, 2023
7df1137
disable redirect to try out edge middleware
fmonper1 May 15, 2023
929be3a
remove catchall route
fmonper1 May 15, 2023
857bc68
remove catchall route
fmonper1 May 15, 2023
5a4d1d2
remove catchall route
fmonper1 May 15, 2023
af74c20
add log to middleware
fmonper1 May 15, 2023
5c31951
add vercel edge config
fmonper1 May 15, 2023
4c711ce
move middleware to root
fmonper1 May 15, 2023
c76b3ce
sanitixe source
fmonper1 May 15, 2023
4d59ee2
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 May 16, 2023
cc4b2ff
more sanitize
fmonper1 May 16, 2023
6862936
update routes
fmonper1 May 16, 2023
dfa96ce
fix middleware
fmonper1 May 16, 2023
837293a
add middleware
fmonper1 May 16, 2023
f2fad7c
remove redirect page and update matcher
fmonper1 May 16, 2023
57f0cd0
add vercel dev script
fmonper1 May 16, 2023
b6366b2
add middleware redirect for one url
fmonper1 May 17, 2023
2edab84
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 May 17, 2023
857055f
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 May 25, 2023
0d28c7a
Merge branch 'chore/DOC-150/remove-vercel-redirects' of github.com:sm…
fmonper1 May 25, 2023
a246144
enable redirects for all
fmonper1 May 25, 2023
ac62e11
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
dwightjl May 26, 2023
00ccde9
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 Jul 21, 2023
c263ac6
Merge remote-tracking branch 'origin/main' into chore/DOC-150/remove-…
dwightjl Jul 27, 2023
0a9b363
Update all packages including hardhat
dwightjl Jul 27, 2023
22d4336
Force node 18
dwightjl Jul 27, 2023
1ede339
Merge remote-tracking branch 'origin/main' into chore/DOC-150/remove-…
dwightjl Jul 29, 2023
532952a
Package updates
dwightjl Jul 29, 2023
78fa630
Add GitHub dependency caching and rebuild package-lock.json
dwightjl Jul 29, 2023
a8f1942
Switch steps order
dwightjl Jul 29, 2023
a21b8dd
Revert unnecessary changes
dwightjl Jul 29, 2023
0f8d6c3
Merge remote-tracking branch 'origin/main' into chore/DOC-150/remove-…
dwightjl Aug 3, 2023
10f8205
Refresh package-lock.json
dwightjl Aug 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ typechain-types/
.tmp

.cache
.vercel
24 changes: 24 additions & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import redirectsFile from "./src/features/redirects/redirects.json"

export const config = {
matcher: "/((?!api|static|.*\\..*|_astro|src).*)",
}

const { redirects } = redirectsFile

export default function middleware(request: Request) {
const url = new URL(request.url)
const pathname = url.pathname
const referrer = request.headers.get("referer")

const redirect = redirects.find((entry) => entry.source === pathname)

if (redirect) {
const finalUrl = new URL(request.url)
finalUrl.pathname = redirect.destination
if (referrer) {
finalUrl.searchParams.append("referrer", referrer)
}
return Response.redirect(finalUrl)
}
}
Loading
Loading