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 as required, then add focused regression tests and implement both default and overridden header behavior.
- Assistant
The repository’s preferred
vpandrgbinaries aren’t installed in this environment, so I’m using the available pnpm and standard search tools. No code changes have been made yet. - Assistant
The installed Next.js 16.2.6 source confirms production behavior: it derives a
revalidate: 0policy for GSSP, emits the exact private/no-cache value only whenCache-Controlis absent, and leaves an existing user header untouched. Vinext already has the canonical constant and header-copying code; the missing piece is applying the default policy after copying GSSP headers. - Assistant
The focused response and data-route unit tests now pass. The fix also corrects the production
/_next/datapath, whose generated code was checking a nonexistentgsspRes.headersproperty instead of the response’sgetHeaders()API; I’m validating the real production server path next. - Assistant
Production HTML and data-response regressions pass, including user overrides. I also guarded the later nonce/ISR policy layer so it cannot overwrite a GSSP-provided
Cache-Control; the final focused tests and repository checks are running now. - Assistant
The combined validation run hit the environment’s process limit (
EAGAIN) because the test runner and 128-thread checker were started together; the actual completed test files passed. I’m rerunning the interrupted entry-template test and checker sequentially to get clean results.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.