Skip to content

fix: Ensure cookies set in middleware are available on initial render #851

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sommeeeer
Copy link
Contributor

For #850

We should remove x-middleware-set-cookie from filteredHeaders. Instead we remove it on the overwrittenResponseHeaders which will be passed to the response.

reqProps in requestHandler.ts will use the original headers object, and pass it into processRequest. This makes sure we will see the header on initial render when using cookies().get() from Next.

Copy link

changeset-bot bot commented May 3, 2025

🦋 Changeset detected

Latest commit: a3b374d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router Patch

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

Copy link

pkg-pr-new bot commented May 3, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@851

commit: a1a3504

@sommeeeer sommeeeer force-pushed the fix-middleware-setcookie branch from 09d3ec3 to 1b6eba2 Compare May 3, 2025 23:04
@sommeeeer sommeeeer requested a review from khuezy May 4, 2025 15:49
Copy link
Contributor

@khuezy khuezy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants