-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(astro): Prevent Netlify from doing a handshake redirect loop (#4745)
- Loading branch information
1 parent
e174858
commit 12f92e9
Showing
5 changed files
with
46 additions
and
2 deletions.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@clerk/astro": patch | ||
--- | ||
|
||
Fix handshake redirect loop in Netlify deployments |
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
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
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,13 @@ | ||
export const NETLIFY_CACHE_BUST_PARAM = '__netlify_clerk_cache_bust'; | ||
|
||
/** | ||
* Removes the temporary cache bust parameter that prevents infinite redirects | ||
* in Netlify and Clerk's dev instance. | ||
*/ | ||
export function removeNetlifyCacheBustParam() { | ||
const url = new URL(window.location.href); | ||
if (url.searchParams.has(NETLIFY_CACHE_BUST_PARAM)) { | ||
url.searchParams.delete(NETLIFY_CACHE_BUST_PARAM); | ||
window.history.replaceState(window.history.state, '', url); | ||
} | ||
} |
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