Repository navigation
fix(astro): Prevent Netlify from doing a handshake redirect loop - #4745
Merged
wobsoriano merged 11 commits intoDec 11, 2024
Merged
wobsoriano merged 11 commits into
wobsoriano merged 11 commits into
Conversation
🦋 Changeset detectedLatest commit: 4e352f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
wobsoriano
commented
Dec 10, 2024
wobsoriano
commented
Dec 10, 2024
| function handleNetlifyCacheInDevInstance(locationHeader: string, requestState: RequestState) { | ||
| // Only run on Netlify environment and Clerk development instance | ||
| // eslint-disable-next-line turbo/no-undeclared-env-vars | ||
| if (import.meta.env.NETLIFY && isDevelopmentFromPublishableKey(requestState.publishableKey)) { |
Member
Author
wobsoriano
requested review from
LekoArts,
anagstef,
octoper,
panteliselef and
tmilewski
December 10, 2024 20:23
wobsoriano
marked this pull request as ready for review
December 10, 2024 20:23
tmilewski
approved these changes
Dec 10, 2024
LekoArts
approved these changes
Dec 11, 2024
wobsoriano
deleted the
rob/eco-202-redirect-loop-in-netlify-and-clerk-dev-instance
branch
December 11, 2024 16:02
jakobevangelista
pushed a commit
that referenced
this pull request
Jan 9, 2025
wobsoriano
added a commit
that referenced
this pull request
Feb 8, 2025
4 tasks done
9 tasks
This branch was successfully deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Netlify caches the responses from pages. When the middleware initiates a handshake redirect and returns to the original URL, Netlify serves the cached response (along with the cookies), leading to an infinite handshake redirect loop.
I've tried using Netlify's cache key variations but it doesn't seem to work.
This PR adds a cache bust parameter to the original URL to prevent Netlify from serving the cached response. The parameter is automatically removed from the URL after the page loads.
I don't have e2e tests for it, but you can compare the ff.:
Resolves ECO-202
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change