Skip to content

Redirect in force static routes sends non http spec compliant Location header #83057

@yoohahn

Description

@yoohahn

Link to the code that reproduces this issue

https://github.com/yoohahn/next-redirect-issue

To Reproduce

  1. yarn install
  2. yarn build ; yarn start
  3. Open Network Tab and then visit http://localhost:3000/en/foo/redirect

Current vs. Expected behavior

When we have a catch all slug that we force-static we get odd behavior using the redirect()

You will get a 307 with 2 Location headers. And there is a Cache time on the 307 redirect (should not be cached).

Image

Using OpenNext adapter will make it even worse since it will concatinate the headers into a comma list

  1. yarn preview
  2. Open Network Tab and then visit http://localhost:3000/en/foo/redirect
Image

Provide environment information

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

Which area(s) are affected? (Select all that apply)

Headers

Which stage(s) are affected? (Select all that apply)

next start (local)

Additional context

When deploying to Vercel we do not get multiple headers nor does it get cached.

Image

This is the expected behaviour running it with start as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    HeadersRelated to the async headers() function.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions