Repository navigation
Conversation
🦋 Changeset detectedLatest commit: e7bf1f2 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 |
allangreatsoftwares
force-pushed
the
fix/per-request-next-private-origin
branch
from
October 2, 2026 20:50
6874df8 to
5a5e711
Compare
allangreatsoftwares
marked this pull request as ready for review
October 14, 2026 05:33
vicb
force-pushed
the
fix/per-request-next-private-origin
branch
from
October 16, 2026 09:26
bac2d4d to
e7bf1f2
Compare
commit: |
vicb
approved these changes
Oct 16, 2026
vicb
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR @allangreatsoftwares 🙏
I have sync'd with main and move the e2e test to a cloudflare specific app (examples/e2e apps are shared with the aws adapter)
Merged
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.
Closes #1413.
init()setsprocess.env.__NEXT_PRIVATE_ORIGINonce per isolate from the first request. Next fetches the target of a server action redirect from that origin, so a worker serving several hosts renders the redirect for whichever host initialized the isolate (in production: users of one tenant sent to another tenant's login).The assignment came from #689, to fix the protocol in preview over
http. Since f1e9457 theattachRequestMetapatch keeps the request protocol ininitURL, which Next uses when__NEXT_PRIVATE_ORIGINis undefined, so the global is no longer needed. It is removed.A getter on
process.envreading anAsyncLocalStoragewould have kept the variable per request, but workerd rejects it (process.env value must not have getter/setter).Tests
app-router: the same redirecting action is submitted fromlocalhostand127.0.0.1, each must render its own host.http): without the fix, afterlocalhostinitializes the isolate, the action from127.0.0.1:8790rendersRendered for host: localhost:8790. With the fix both hosts render their own host.pnpm code:checksandpnpm --filter cloudflare testpass.