-
Notifications
You must be signed in to change notification settings - Fork 395
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
fmonper1
wants to merge
37
commits into
main
Choose a base branch
from
chore/DOC-150/remove-vercel-redirects
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 26 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
1242956
remove vercel redirects
fmonper1 b3b14c7
add original url
fmonper1 c2252fa
add edge middleware
fmonper1 5ed0020
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 ca7ecd8
disable redirect to try out edge middleware
fmonper1 7df1137
disable redirect to try out edge middleware
fmonper1 929be3a
remove catchall route
fmonper1 857bc68
remove catchall route
fmonper1 5a4d1d2
remove catchall route
fmonper1 af74c20
add log to middleware
fmonper1 5c31951
add vercel edge config
fmonper1 4c711ce
move middleware to root
fmonper1 c76b3ce
sanitixe source
fmonper1 4d59ee2
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 cc4b2ff
more sanitize
fmonper1 6862936
update routes
fmonper1 dfa96ce
fix middleware
fmonper1 837293a
add middleware
fmonper1 f2fad7c
remove redirect page and update matcher
fmonper1 57f0cd0
add vercel dev script
fmonper1 b6366b2
add middleware redirect for one url
fmonper1 2edab84
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 857055f
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 0d28c7a
Merge branch 'chore/DOC-150/remove-vercel-redirects' of github.com:sm…
fmonper1 a246144
enable redirects for all
fmonper1 ac62e11
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
dwightjl 00ccde9
Merge branch 'main' into chore/DOC-150/remove-vercel-redirects
fmonper1 c263ac6
Merge remote-tracking branch 'origin/main' into chore/DOC-150/remove-…
dwightjl 0a9b363
Update all packages including hardhat
dwightjl 22d4336
Force node 18
dwightjl 1ede339
Merge remote-tracking branch 'origin/main' into chore/DOC-150/remove-…
dwightjl 532952a
Package updates
dwightjl 78fa630
Add GitHub dependency caching and rebuild package-lock.json
dwightjl a8f1942
Switch steps order
dwightjl a21b8dd
Revert unnecessary changes
dwightjl 0f8d6c3
Merge remote-tracking branch 'origin/main' into chore/DOC-150/remove-…
dwightjl 10f8205
Refresh package-lock.json
dwightjl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ typechain-types/ | |
.tmp | ||
|
||
.cache | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this allows us to test the middleware locally without deploying to vercel