Skip to content

[NEXT-735] Using headers.append twice with the Set-Cookie header only adds a single header #46579

Description

@controversial

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 22.4.0: Fri Feb 10 08:08:36 PST 2023; root:xnu-8796.100.721.505.3~4/RELEASE_ARM64_T6000
Binaries:
  Node: 19.6.0
  npm: 9.4.0
  Yarn: 3.3.1
  pnpm: N/A
Relevant packages:
  next: 13.2.2-canary.3
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

Middleware / Edge (API routes, runtime)

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/mystifying-babbage-ruhtyx?file=%2Fpages%2Fapi%2Ftest.ts

To Reproduce

Visit /api/test with devtools open to observe the cookies sent with the request.

Describe the Bug

Only a single Set-Cookie header is sent and only a single cookie is set:
Screenshot 2023-02-28 at 3 50 42 PM

Expected Behavior

Two Set-Cookie headers should be added, as the fetch standard specifies.

This issue is very similar to #38302; @balazsorban44 asked that I open this issue to track this separate reproduction!

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-735

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions