Skip to content
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

[NEXT-582] Unable to define multiple Set-Cookie headers via config headers #40518

Closed
1 task done
awareness481 opened this issue Sep 13, 2022 · 3 comments
Closed
1 task done
Labels
linear: next Confirmed issue that is tracked by the Next.js team. Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation.

Comments

@awareness481
Copy link
Contributor

awareness481 commented Sep 13, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 20.6.0: Tue Feb 22 21:10:42 PST 2022; root:xnu-7195.141.26~1/RELEASE_ARM64_T8101
Binaries:
  Node: 16.15.1
  npm: 8.19.1
  Yarn: N/A
  pnpm: 7.6.0
Relevant packages:
  next: 12.3.1-canary.1
  eslint-config-next: 12.3.0
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

It is impossible to define multiple Set-Cookie headers, via next.config.js/headers. Next.js seems to only account for the last defined Set-Cookie header for a given path

Expected Behavior

Based on the rfc I would expect to be able to define multiple Set-Cookie headers and for the headers to not be combined into one header. (they re not combined atm, only the last header is used)

Link to reproduction

https://github.com/awareness481/next-config-cookies

To Reproduce

  1. See that next.config.js has two Set-Cookie headers for each route
  2. Visit http://localhost:3000/1 and observe that only one cookie is defined
  3. Visit http://localhost:3000/2 and observe that only one cookie is defined

NEXT-582

@awareness481 awareness481 added the bug Issue was opened via the bug report template. label Sep 13, 2022
@balazsorban44 balazsorban44 added kind: bug Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation. and removed bug Issue was opened via the bug report template. labels Sep 15, 2022
@volnei
Copy link

volnei commented Oct 18, 2022

There are any workaround for this?

@balazsorban44 balazsorban44 added the linear: next Confirmed issue that is tracked by the Next.js team. label Feb 17, 2023
@balazsorban44 balazsorban44 changed the title Unable to define multiple Set-Cookie headers via config headers [NEXT-582] Unable to define multiple Set-Cookie headers via config headers Feb 17, 2023
@floriangosse
Copy link
Contributor

This affects setting multiple Link headers as well. This actually a blocker for doing performance optimizations via preconnect, preload, ... Link headers. And, at the moment doesn't seem to be a workaround.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
linear: next Confirmed issue that is tracked by the Next.js team. Linking and Navigating Related to Next.js linking (e.g., <Link>) and navigation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants