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
Let me look at the data-request (JSON) path in the server entry:
- Assistant
Now let me look at the test setup in
tests/pages-router.test.ts: - Assistant
Let me look at pages-server-entry.ts imports and structure (it's a template):
- Assistant
Now I'll make the changes. First,
pages-page-response.ts— apply the default gssp Cache-Control: - Assistant
Now the dev server for parity. Add the import:
- Assistant
Now add tests. Dev tests first — after the existing gssp headers test:
- Assistant
Now the dev
_next/datadescribe — extend the gssp JSON test and add a custom-cache one: - Assistant
Now find the prod
_next/datadescribe (line ~3726 before my edits) and the prod SSR tests: - Assistant
Add unit tests to
tests/pages-page-response.test.ts: - Assistant
Unit tests pass. Now run the full pages-router integration test suite (dev + prod paths):
- Assistant
Now run the typecheck/lint:
- Assistant
All done. Here's a summary of the fix:
Root causes
- No default gssp
Cache-Control:renderPagesPageResponseonly setCache-Controlfor nonce or ISR responses — plain gssp HTML responses shipped with no caching header at all. - User dropped on responses: the generated server entry read , a property that doesn't exist on the gssp response object (it only exposes ), so gssp headers were silently dropped from data JSON responses.
- No default gssp
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.