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 Pages Router GSSP handling in dev and production, first checking the local Next.js reference tests/source as required, then add focused regressions and implement parity.
- Assistant
vpisn’t installed in this environment, so I’ll use the repository’spnpmscripts for targeted validation. The dependency tree appears already present enough to begin inspection. - Assistant
The required local
.nextjs-refcheckout is absent, and the task explicitly disallows network access, so I can’t fetch the referenced Next.js suite. I’ll use the exact upstream test path and expected behavior supplied in the issue as the authoritative parity target. Also,rgis unavailable here, so I’m falling back tofind/grep. - Assistant
The production renderer already forwards GSSP headers through its typed response helper; the concrete gap is that it never supplies the Next.js default. I’m adding coverage for both the default and explicit override, including fixture-level dev/prod assertions, then I’ll make the default conditional so user headers retain precedence.
- Assistant
The focused helper tests now pass. The generated production entry had a second bug matching the report: it checked a nonexistent
gsspRes.headersfield instead ofgetHeaders(), so custom headers were indeed discarded on data responses. Delegating through the shared header helper fixes both that forwarding path and the default policy consistently.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.