Skip to content

[BUG] Duplicated Location Headers is joined. #962

@yoohahn

Description

@yoohahn

Describe the bug

This is an issue with it's origin within NextJS, but that might be fixable in OpenNext? It is only an issue running NextJS in a self-hosting environment OR deploying using OpenNext (Cloudflare in my case) and not an issue when deploying to Vercel.

Important note is that this has only been seen on a route that is a catch all slug with the force-static flag set.

Steps to reproduce

  1. https://github.com/yoohahn/next-redirect-issue
  2. yarn install
  3. yarn preview
  4. Have the Network Tab Open and then visit http://localhost:3000/en/foo/redirect

In open next we get a chain of 307 -> 200.

  1. First will be a 307 with cache headers on it.Open Next:
Image

Since NextJS sends 2 Location headers this two will get joined into a comma list. But there is no way for us to act on this since it is far into the redirect chain.

Vercel:
Image

No cache and only 1 Location header NOT comma separated.

  1. And then sent to the url with comma list
Image

Next time I visit the same url it acts as I expect. So it is only an issue the first visit.

Expected behaviour

  1. Only 1 Location and not being a comma list of Locations.
  2. No cache on the 307

@opennextjs/cloudflare version

1.6.5

Wrangler version

4.28.1

next info output

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:51 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 24.1.0
  npm: 11.3.0
  Yarn: 4.9.4
  pnpm: N/A
Relevant Packages:
  next: 15.5.1-canary.9
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A

Additional info

I have deployed this worker to Cloudflare with the exact same behaviour as in

Image

Issue on NextJS

vercel/next.js#83057

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions