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
Let me start by understanding the repository structure and the issue. The issue is about Pages Router's
getServerSideProps(gssp) andgetStaticPropsresponses missing the defaultCache-Controlheader and user-setCache-Controlheader viares.setHeader.Let me explore the repository structure first.
Assistant
This looks like a Next.js fork (vinext). Let me explore the packages directory to understand the structure better.
Assistant
There's only one package:
vinext. Let me explore it.Assistant
Let me look at the source directory to understand the structure.
Assistant
Let me look at the deploy.ts file since the issue mentions "deploy mode" and gssp
Assistant
Let me search more broadly for
Cache-Controland gssp-related code across the source:Assistant
Let me search specifically for gssp and getServerSideProps handling:
Assistant
Let me look at the pages-server-entry.ts file, especially around the gsspRes header forwarding area
Assistant
Let me read the pages-server-entry.ts file around line 710 where gsspRes headers are forwarded.
Assistant
Let me open the file with the correct syntax:
Assistant
Let me continue reading to see the full response building logic
Assistant
Now let me look at
__renderPagesPageResponseinpages-page-response.tsAssistant
Let me open the pages-page-response.ts file
Assistant
Let me look at the
renderPagesPageResponsefunctionAssistant
Let me read the rest of the file
Assistant
Now I can see the issue. Let me look at the
applyGsspHeadersfunction first and check for existing constantsAssistant
Let me look at the cache-control.ts file for existing constants
Assistant
Now I understand the issue. Let me also look at the data request path and understand the flow better
Assistant
Let me find where
__buildNextDataJsonResponseisAssistant
Let me examine the
buildNextDataJsonResponsefunctionAssistant
Let me look at the relevant test to understand expected behavior
Assistant
Let me look at the pages-page-response test and cache-control test
Assistant
Let me read the full test file to understand the test cases
Assistant
Let me trace how
gsspResis created and how headers flow through the systemAssistant
Let me look at the pages-page-data.ts file to understand how gsspRes is created
Assistant
Let me find
createGsspReqResto understand how headers are capturedAssistant
Let me look at the
createGsspReqResimplementationAssistant
Let me find
__createPagesReqResto understand the response object implementationAssistant
Let me look at the
createPagesReqResin pages-node-compat.tsAssistant
Let me read the rest of the
createPagesReqResfunction to seegetHeadersAssistant
Now I have a clear understanding of the issue. Let me also verify there's a bug in the data request path where
gsspRes.headersis used instead ofgsspRes.getHeaders(). But first, let me look at the types more carefully to confirm.Assistant
Let me look at the type definitions for
PagesGsspResponseand `PagesMutableGsspResponseAssistant
Let me find the
PagesGsspResponsetype definitionAssistant
Now I have a clear understanding of the issues. Let me summarize:
- In
renderPagesPageResponse(pages-page-response.ts): For gssp pages, neitherscriptNoncenorisrRevalidateSecondsis truthy, so theCache-Controlheader is never set. - In the data request path (pages-server-entry.ts line 714): Uses
gsspRes.headers(property access) instead ofgsspRes.getHeaders()(method call), so user-set headers are never forwarded.
Let me fix both issues.
First, let me fix
pages-page-response.tsto set the defaultNEVER_CACHE_CONTROLfor gssp pages- In
Assistant
Now let me fix
pages-page-response.ts. First, import `NEVER_CACHE_CONTROLAssistant
Now let me fix the
renderPagesPageResponsefunction to add default Cache-Control for gssp pagesAssistant
Now let me fix the
renderPagesPageResponsefunction to add the default Cache-Control for gssp pages:Assistant
Now let me fix the data request path in
pages-server-entry.ts. Let me look at the exact code:Assistant
Let me check the imports at the top of pages-server-entry.ts to see what's available
Assistant
Let me understand the template structure better. Let me look at how the import statements are generated:
Assistant
Let me find the beginning of the template string that contains the data request handling
Assistant
Let me look at the template string beginning at line 207
Assistant
Now let me fix the data request path. I need to replace lines 712-722 with fixed code:
Assistant
Now I also need to add the default
Cache-Controlheader for gssp data responses. Let me modify the data path to add the default:Assistant
Now let me run the existing tests to verify my changes
Assistant
Let me check how tests are run
Assistant
Let me try running tests with pnpm
Assistant
Let me try
vpfor running testsAssistant
Let me try running vitest directly
Assistant
Let me try running the test using the setup in the project
Assistant
Let me verify the changes are syntactically correct by checking with TypeScript
Assistant
TypeScript compilation passes. Let me also check for any other instances of
gsspRes.headerspattern in the codebaseAssistant
No more instances found. Let me verify the changes are correct by reviewing them
Assistant
Let me also check if there are any other similar issues with
gsspResaccess patterns in the codebaseAssistant
Let me verify there are no other issues with gsspRes in pages-page-data
Assistant
Let me check the return value at line 547
Assistant
Let me check if the dist directory contains pre-built versions that also
Assistant
Let me check if the dist files are compiled versions of the source files
Assistant
Let me check the dist version of pages-page-response.js for the current Cache-Control logic
Assistant
Let me check what the dist version of pages-server-entry.js contains
Assistant
I need to also update the dist files. Let me fix the dist version of pages-server-entry.js
Assistant
Let me fix the dist version of pages-server-entry.js
Assistant
Now let me fix the dist version of pages-page-response.js
Assistant
Let me look at the Cache-Control logic in the dist file
Assistant
Let me fix the dist version of pages-page-response.js. First update the import:
Assistant
Now add the else-if clause for gssp in the dist file
Assistant
Let me verify the cache-control dist file also exports
NEVER_CACHE_CONTROL:Assistant
Let me check the full diff of all
Assistant
Let me check if dist is gitignored
Assistant
The dist files are gitignored, so only the source files matter. Let me revert the dist changes and focus on the source.
Assistant
Let me verify git status to see what will be submitted
Assistant
Let me review the final diff of the changes
Assistant
The changes look correct. Let me now verify the TypeScript compilation still
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.