ISSUE DESCRIPTION Pages Router: gssp/getStaticProps responses missing default and…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Assistant
I’ll trace the Pages Router server-side props response path, identify where response headers are collected or discarded, reproduce the missing-header behavior with the existing test setup if practical, then patch the smallest shared path and run targeted tests/type checks. I will not modify repository tests.
- Assistant
The deploy path already retains gSSP headers through
gsspRes.getHeaders()andapplyGsspHeaders; the missing behavior is that it never supplies the Pages Router’s never-cache policy when no header was set. I’ll add the sharedNEVER_CACHE_CONTROLconstant at the final Pages response boundary, conditionally only for gSSP responses so static/ISR policies are unaffected, and apply the same fallback to/_next/dataresponses. Explicit user values remain authoritative because the fallback is guarded byheaders.has(). - Assistant
The first edit command could not run because this environment has no
python3; no files were changed. I’ll perform the same precise replacements with Node, then run the focused Pages response tests. - Assistant
The focused response suite passes, and the repository check reports no formatting, lint, or type errors. I also found and corrected a second concrete defect in the data-navigation path: it was reading nonexistent
gsspRes.headersinstead ofgetHeaders(), which explains why explicit headers could be dropped there. I’ll make the equivalent default policy apply in the dev Pages path as well, keeping behavior consistent across development and deploy servers, then rerun checks. - Assistant
The optional dev-path edit was not applied because the temporary Node edit script had a syntax error; the working tree remained unchanged by that attempt. The deploy/server-entry and shared response fixes are intact, and the final repository checks still pass. Since the reported failures are in deploy mode and the shared streamed response is the production path, I’m keeping the patch scoped to those verified paths.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.