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.
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 call ) 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
Let me start by exploring the repository structure to understand how it's organized and find the relevant code for handling gssp (getServerSideProps) responses in the Pages Router.
Assistant
No Python files. Let me check what kind of project this is.
Assistant
This is a TypeScript/Node.js project. Let me explore the packages directory to find the relevant code.
Assistant
The issue is about Pages Router's getServerSideProps (gssp) responses missing
Cache-Controlheaders. This is in the vinext package. Let me explore the vinext package.Assistant
This is a TypeScript project (vinext) that seems to be a Vercel/Vinxi Next.js adapter. The issue is about Pages Router gssp (getServerSideProps) responses missing
Cache-Controlheaders.Let me first explore the source code structure to understand how the Pages Router is handled, especially for getServerSideProps.
Assistant
Let me search for files related to getServerSideProps, gssp, or Pages Router handling.
Assistant
Let me start by examining the key files related to gssp and Cache-Control. I'll begin with the cache-control.ts file and pages-page-response.ts.
Assistant
Good, I found the
NEVER_CACHE_CONTROLconstant. Now let me look at how gssp responses are handled in the Pages Router.Assistant
I found the key file. Let me examine the issue more closely. The
renderPagesPageResponsefunction applies Cache-Control headers only in two cases:- When
scriptNonceis set (usesno-store, must-revalidate) - When
isrRevalidateSecondsis set (usesbuildRevalidateCacheControl)
But there's NO default
Cache-Controlheader for gssp pages that don't match either of these conditions. Let me also check the test file to understand the expected behavior.- When
Assistant
Let me check if there's a test for gssp in the test suite.
Assistant
Let me look at the pages-page-response.test.ts and pages-router.test.ts files to understand how gssp is tested and what the expected behavior is.
Assistant
Now I have a clear picture. Let me look at the
prod-server.tsto understand how gssp responses flow through the system.Assistant
Now let me search for where
gsspResis being created and passed torenderPagesPageResponse.Assistant
Let me search more broadly for how gsspRes is created and where pages page response is rendered.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "gsspRes|renderPagesPageResponse|getServerSideProps" /vinext/packages/vinext/src --include="*.ts" -l </tool_call>
Assistant
The command didn't execute properly - let me re-run it.
Assistant
Let me look at the dev-server.ts and the pages-server-entry.ts to understand how gssp responses are handled:
Assistant
Let me look at the dev-server.ts file more closely to understand the gssp flow.
Assistant
Let me continue reading the dev-server.ts to see how gssp headers are forwarded.
Assistant
Let me search for where
gsspResis created and passed torenderPagesPageResponse:Assistant
The dev-server.ts doesn't pass
gsspResdirectly. Let me search more broadly:Assistant
Let me look at the pages-server-entry.ts file to understand how gsspRes is created and passed through.
Assistant
Now let me look at the pages-page-data.ts file to see how
gsspResis created:Assistant
Now let me look at the
createGsspReqResfunction to understand howgsspResis created:Assistant
Let me look at the pages-server-entry.ts to find where
createGsspReqResis defined:Assistant
Let me look at the createGsspReqRes function definition to understand how gsspRes is created.
Assistant
Now I need to look at
__createPagesReqResto see how the gsspRes is created.Assistant
So
__createPagesReqResis imported from a pages node compatibility path. Let me find where that's defined.Assistant
Let me look at the pages-node-compat.ts file:
Assistant
Assistant
I forgot to use the proper tool call format. Let me fix that.
Assistant
Now let me look at the exact section I need to modify:
Assistant
Now I understand the full picture. Let me implement the fix:
- Import
NEVER_CACHE_CONTROLfrom the cache-control module - Modify the Cache-Control logic to:
- Only set default/ISR/nonce Cache-Control if one is not already set (from user via
res.setHeader) - Apply the default
NEVER_CACHE_CONTROLfor plain gssp pages that don't have ISR or nonce
- Only set default/ISR/nonce Cache-Control if one is not already set (from user via
Let me edit the file:
- Import
Assistant
Now I need to modify the Cache-Control logic. Let me see the exact lines to replace:
Assistant
Now I need to replace the Cache-Control logic. The current logic is:
typescriptif (options.scriptNonce) { responseHeaders.set("Cache-Control", "no-store, must-revalidate"); } else if (options.isrRevalidateSeconds) { responseHeaders.set( "Cache-Control", buildRevalidateCacheControl(options.isrRevalidateSeconds, options.expireSeconds), ); setCacheStateHeaders(responseHeaders, "MISS"); }I need to change it to:
typescriptAssistant
The replace command needs SEARCH and REPLACE text. Let me do it properly.
Assistant
The replace command needs the SEARCH and REPLACE text blocks. Let me construct it properly.
Assistant
I need to use the replace command properly with the SEARCH and REPLACE blocks. Let me look at the current code again and construct the proper command.
Assistant
Let me use the edit command instead of replace to modify the specific lines.
Assistant
Let me use bash to make the replacement directly:
Assistant
I need to replace lines 379-387 (the Cache-Control logic). Let me use sed to do this.
Assistant
I need to replace lines 379-387 in the file. Let me use sed or a different approach. Let me try using a Python or Node.js script to do the replacement.
Assistant
Let me try using node.js instead.
Assistant
Good, node is available. Let me use node to do the replacement.
Assistant
The
rencoding is not valid in newer Node.js versions. I need to useutf8instead.Assistant
The replacement was successful. Let me verify the changes:
Assistant
The import wasn't updated. Let me add the import for
NEVER_CACHE_CONTROL:Assistant
Let me verify the import was updated:
Assistant
Now let me verify the Cache-Control logic:
Assistant
The changes look good. Now let me verify the TypeScript compiles correctly and run the existing tests.
Assistant
The TypeScript errors are all about module resolution (path aliases like
vinext/shims/*), not about my actual changes. This is expected in a monorepo with custom build tools. Let me run the existing tests to validate my changes.Assistant
Let me run the existing tests for pages-page-response:
Assistant
The test is asking for confirmation to install vitest. Let me try using pnpm instead since this is a pnpm workspace.
Assistant
Let me try running the tests using pnpm. First, let me check what scripts are available.
Assistant
Let me try running the tests using pnpm:
Assistant
Let me check if vitest is already installed in node_modules:
Assistant
The vitest binary isn't installed. Let me check if there's a vp command that wraps vitest, or let me try installing dependencies first.
Assistant
Let me check what
vpis and if we can use it:Assistant
Let me try running the vp test command with dependencies installed:
Assistant
Dependencies are installed. Let me check if vitest is now available:
Assistant
The vitest isn't in the node_modules/.bin directory. Let me check the package structure for vitest.
Assistant
The vitest binary is not installed in node_modules/.bin. This is likely a workspace that uses vite-plus/test. Let me check the vite.config.ts and see how tests are run.
Assistant
Let me try running the tests with
vp test:Assistant
All 9 existing tests pass. Now let me verify the fix by writing a quick test script to check both scenarios:
- Default gssp Cache-Control for pages without ISR or nonce
- User-set Cache-Control via
res.setHeaderis preserved
Assistant
All 9 existing tests pass! Now let me write a quick verification test to confirm my fix works correctly. Let me create a test script that verifies both the default gssp Cache-Control and user-set Cache-Control scenarios.
Assistant
The user wants me to run the test I just created to verify my fix works correctly. Let me run the test.
Assistant
All 4 new tests pass. Let me now run all existing tests to make sure my changes don't break anything:
Assistant
All existing tests pass. Let me run a broader set of tests to ensure the fix doesn't break anything else in the codebase, and then clean up.
Assistant
All tests pass. Let me clean up the temporary test file I created and do a final review of my changes.
Assistant
Let me verify my final changes with a git diff:
Assistant
The changes look good. Let me provide a summary of what was fixed and verify the checklist:
Summary of Changes
The issue was that Pages Router
getServerSideProps(gssp) responses in vinext were missing theCache-Controlheader entirely. The default value"private, no-cache, no-store, max-age=0, must-revalidate"was never applied for plain gssp pages, and user-set headers via could be overwritten.Assistant
The user wants me to submit my changes using the submit command. I need to use the proper syntax for the submit command.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.