Skip to content

Conversation

cboar
Copy link

@cboar cboar commented Sep 10, 2025

I ran into an issue where multiple Set-Cookie headers were being joined into a single header, which is not valid. I found that the convertRes function flattens all headers right before constructing the InternalResult. Since InternalResult allows string[] headers, I rewrote the parseHeaders to keep these as is. Since the method is also used elsewhere, I renamed the original implementation to flattenHeaders to better reflect its behavior.

Partially fixes #962

Copy link

changeset-bot bot commented Sep 10, 2025

⚠️ No Changeset found

Latest commit: 2e3faf1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cboar cboar force-pushed the fix/prevent-header-flatten branch from 07df95a to 2e3faf1 Compare September 11, 2025 03:12
@cboar
Copy link
Author

cboar commented Sep 11, 2025

@sommeeeer I see #977 solves a similar issue exclusively for Location, but this also seems to affect Set-Cookie when multiple cookies are set.

For context, I am using a custom wrapper built for AWS ALB responses (not API Gateway), it has been helpful to not join the headers returned from InternalResult.

Copy link

pkg-pr-new bot commented Sep 15, 2025

Open in StackBlitz

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

commit: 2e3faf1

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.

[BUG] Duplicated Location Headers is joined.
1 participant