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.Expected: "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) usinggit statusorgit diffcommands. 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 request/response path for
getServerSideProps, identify where response headers are represented and finalized, then reproduce with existing tests or a temporary harness. I’ll make the smallest source change preserving user headers while applying the default only when absent, run targeted tests/type checks, inspect the diff, and submit once verified. - Assistant
rgis unavailable in the environment, so I’ll usegrep/findinstead. The repository is a TypeScript monorepo; I’m narrowing the search to runtime packages and tests before editing. - Assistant
The production path already collects gSSP headers, but
applyGsspHeadersonly copies them and never supplies the dynamic-page default. The dev path similarly forwards captured headers without a default. I’ll centralize the default behavior in the production response helper and mirror it in dev, checking case-insensitively soCache-Controlset with any casing wins. This preserves explicit values and avoids affecting static/ISR pages. - Assistant
The first edit attempt was blocked because this image has neither
rgnorpython3; no files were changed. I’ll apply the same precise replacements with the available Node runtime. - Assistant
The change is now in place in both production/deploy rendering and dev rendering. The production helper applies the default after copying gSSP headers; the dev path adds it only for a gSSP page and only when no case-insensitive override exists. I’ll run the focused unit tests and type/check tooling next.
- Assistant
The combined verification command timed out because Corepack tried to download pnpm and prompted interactively; it did not execute the tests. I’ll bypass Corepack using the repository-local binaries and run smaller commands with bounded output.
- Assistant
Focused
pages-page-responsetests pass (9/9), TypeScript compilation produced no errors, andgit diff --checkis clean. Since existing tests don’t directly cover this exact header default/override pair, I’ll run the broader unit suite (or the closest available subset) and lint the modified files to catch integration and style issues. - Assistant
The full unit suite passes: 4,755 tests passed, 2 skipped. The repository’s standalone
oxlintwrapper is intentionally nonfunctional outside IDE mode, but the source compiles and formatting diff checks are clean. I’ll do a final diff/status review, then submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.