Pages Router: gssp/getStaticProps responses missing default and user-set Cache-Control…
- User
Pages Router: gssp/getStaticProps responses missing default and user-set
Cache-ControlheaderThis issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext
mainvs Next.jsv16.2.6, 2026-05-22).Problem
Pages Router gssp responses lack
Cache-Controlheaders. Tests expect the defaultprivate, no-cache, no-store, max-age=0, must-revalidatefor gssp pages and custom values set viares.setHeader('Cache-Control', ...), but vinext returnsnull. The default header is not applied and usersetHeadercalls are dropped.codeExpected: "private, no-cache, no-store, max-age=0, must-revalidate" Received: nullEstimated Impact
~2 test failures across the deploy suite.
Affected Test Suites
test/e2e/getserversideprops/test/index.test.ts(2 failures)
Recommendation
-
Reproduce first in vinext's own test suite. Add a Pages Router gssp page and assert the response carries the default
Cache-Controlheader; add a second page that overrides it viares.setHeaderand assert the override sticks. -
Emit the default gssp Cache-Control. When serving a gssp response in deploy mode, set
Cache-Control: private, no-cache, no-store, max-age=0, must-revalidateunless the user set it explicitly. -
Preserve
res.setHeaderoverrides. Make sure headers set during gssp dispatch are forwarded to the final HTTP response.
Interface
No new interfaces are introduced.
- Assistant
I’ll trace the Pages Router request paths in dev and production, compare the local Next.js reference tests/source, then add focused regressions and fix both paths if needed.
- Assistant
vpisn’t installed in this environment, so I’m using the repository’s equivalentpnpmcommands. I’m checking the worktree and the local Next.js clone before editing. - Assistant
The local Next.js reference clone is absent, and network use is disallowed for this task, so I can’t perform the upstream source search. I’ll rely on the issue’s pinned expected behavior and the repository’s existing compatibility patterns.
rgis also unavailable here; I’m falling back togrep/find. - Assistant
The production flow already retains general gSSP headers through its mutable response adapter, but it never supplies the default cache policy. The dev flow relies on implicit Node header merging and contains an unfinished header snapshot. I’m making the policy explicit at gSSP dispatch so HTML and
/_next/dataresponses share the same behavior, while preserving a user-set value. - Assistant
The implementation and regressions are in place. I’m first running the focused data-dispatch tests, then the Pages Router integration file to exercise actual dev and production HTTP responses.
- Assistant
Both focused unit tests and real HTTP regressions pass in dev and production. I’m running the repository check now to catch formatting, lint, and type issues introduced by the response-interface change.
- Assistant
The repository check initially caught a test typing mistake; I corrected it, and the full format/lint/type check now passes. The focused unit suite remains green after that correction.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.