#82117·Next.js

Duplicate Location and x-nextjs-stale-time in Header using redirect/permanentRedirect alongside dynamic 'force-static'

Author: d-mon-Created Jul 28, 2025Updated Sep 28, 2026
Labelslinear: nextHeaders

Link to the code that reproduces this issue

https://github.com/d-mon-/test-redirect

To Reproduce

  1. Build and run the server with npm run build && npm run start
  2. Go to http://localhost:3000/test with the network console opened
  3. You shall notice the Location header duplicated

Current vs. Expected behavior

Currently you will notice the Location and x-nextjs-stale-time fields to be duplicated in the header

screenshotImage

I'd expect to see only a single field for each of them. This is problematic as the user will be redirected to /redirect,/redirect instead of /redirect depending on how the Location value is processed in production

Provide environment information

bash
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6031
  Available memory (MB): 65536
  Available CPU cores: 16
Binaries:
  Node: 22.16.0
  npm: 11.4.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.4.4 // Latest available version is detected (15.4.4).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
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

The problem seems to happen since the 15.4.1 release (previous versions seem fine)

I identified these two blocks adding the headers: the first call is doing a setHeader location (using NodeNextResponse) https://github.com/vercel/next.js/blob/ad1e3f209b87b6cc4829b125a667e94f7193f62f/packages/next/src/server/app-render/action-handler.ts#L1061 the second call is doing an appendHeader of {location, x-nextjs-stale-time}, duplicating the value. This one seems to use the native function this time instead of NodeNextResponse which doesn't check for the existing values. https://github.com/vercel/next.js/blob/ad1e3f209b87b6cc4829b125a667e94f7193f62f/packages/next/src/build/templates/app-page.ts#L1010-L1031

A potential candidate: https://github.com/vercel/next.js/pull/73431

NEXT-4749