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.
Interface
No new interfaces are introduced.
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 usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /vinext, current file: none) bash-$
Assistant
Now let's find the test spec that checks headers to understand existing behavior and where actual response header assertions happen.
Assistant
Now let's update the code to add default Cache-Control for plain gssp responses when not already set and not ISR/nonce case.
Assistant
Let's use the editor tool instead.
Assistant
Now let's replace the response header logic block.
Assistant
Now let's check the JSON data-route path (
_next/data) for gssp too, since the issue mentions both HTML and data responses possibly. Let's checkpages-data-route.tsand the JSON envelope building in pages-server-entry.ts around line 705-720.Assistant
Let's check how tests are run and check package.json scripts.
Assistant
Build succeeded. Now let's run the specific test for gssp headers.
Assistant
Test passes. Now let's write a temporary reproduce script to verify default Cache-Control is applied for
/ssr(no user override) and preserved for/ssr-headers(if user sets it). Let's check if there's a fixture with user-set Cache-Control already.Assistant
I'll temporarily add assertions inline to existing test, run, then revert with git checkout.
Assistant
Also let's add cache-control assertion to the existing ssr-headers test (user sets custom header but not Cache-Control) to confirm the default still applies there too.
Assistant
Let's add a
usedGetServerSidePropsflag near line 505 and set it true once gssp finishes without short-circuit, then use it in the extraHeaders block.Assistant
Now set
usedGetServerSideProps = trueafter the header-forwarding loop completes.Assistant
Now let's check the
_next/datashort-circuit for gssp in dev-server too, since that's separate. But focus first on updating extraHeaders logic around line 1058 (now shifted).Assistant
Now update the extraHeaders block.
Assistant
Now let's rerun the tests.
Assistant
All gssp tests pass including our temp override test and default cache-control test. Now let's run the full test suite to check for regressions, and also check the production build path (pages-page-response.ts) more thoroughly, plus check other places like
_next/datajson envelope andres.end()short-circuit paths.Assistant
All Pages Router related test files pass (292 passed). Now let's check the production build path for gssp header test too — run pages-router-prod.test.ts specifically for prod build cache-control.
Assistant
There's a prod-built test at line 2857. Let's check that section for
/ssrunder production build with worker/nitro entry to test our production path fix.Assistant
Let's remove those erroneously appended lines from dev-server.ts.
Assistant
Good, file now ends correctly. Let's verify by diffing against original checkpoint and double check with tsc/build.
Assistant
That's clean now. Let's now add the temp test assertion correctly to pages-router.test.ts by opening that file first.
Assistant
Good, that file was untouched. Now open pages-router.test.ts explicitly and edit at correct location.
Assistant
Good, this time it edited the correct file. Now let's find that test name and run it.
Assistant
Production build path passes too. Now let's run the entire pages-router.test.ts and related test files fully to be sure nothing else broke.
Assistant
All 242 tests pass. Now let's run other related test files (e.g., prerender, pages-i18n-prod, pages-router-concurrency) as well as broader integration suite to be extra safe.
Assistant
Still running. Let's wait more.
Assistant
All 42 integration test files pass (1464 passed, 2 skipped — expected skips). Now let's clean up the temporary test additions and fixture file, then run one more final check.
Assistant
Now revert the temp test file and remove the temp fixture, keeping the actual source fix.
Assistant
Now let's rebuild and re-run the full existing test suite once more (without temp modifications) to confirm nothing is broken by the final state of source changes.
Assistant
All 241 pre-existing tests pass (back to original count, since I reverted temp additions). Let's view the final diff.
Assistant
Now let's also restore that removed blank line for cleanliness (optional, cosmetic) - let's check.
Assistant
That's fine, minor cosmetic diff. Not a problem. Let's run lint/check to be safe.
Assistant
Formatting passes. Let's run the full pages-router test file once more plus the whole integration project quickly to confirm final state, and also check git diff is clean of test/fixture changes.
Assistant
Only source files changed. Let's do a final full test run for the integration project once more to be safe (in background due to timeout).
Assistant
All integration tests pass. Now let's also run the unit project quickly to ensure the cache-control unit tests pass.
Assistant
Everything passes. Let's view the final diff for review.
Assistant
This is a clean, focused diff. Let's do final checklist review.
Assistant
dist/ is gitignored, so no stray build artifacts in the diff. The changes are clean.
Assistant
Now let's go through the checklist explicitly.
Assistant
The fix is complete, verified, and all tests pass. Let's do a final sanity check of the git diff before submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →