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 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
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 in vinext. Let me explore the repository first.Let me understand:
- vinext is some kind of Next.js deployment adapter
- The issue is that gssp responses don't have
Cache-Controlheaders set by default - The expected default is
private, no-cache, no-store, max-age=0, must-revalidate - User-set
Cache-Controlheaders viares.setHeaderare also being dropped
Let me explore the repo structure and find relevant code.
Assistant
This looks like the vinext repository (the Next.js deploy adapter). Let me explore the packages directory since that's likely where the core logic is.
Assistant
Let me explore the vinext package in more detail.
Assistant
Let me explore the src directory of vinext.
Assistant
Let me search for "Cache-Control" across the codebase to understand where headers might be set.
Assistant
Now let me focus on the key source files. Let me look at the pages response handling and the server code for pages
Assistant
Let me read the key files one at a time. Let me start with the pages-page-response.ts:
Assistant
Now let me look at how gssp responses are dispatched and how
gsspResis created. Let me search for where gssp is invoked:Assistant
Let me look at the pages server entry where gsspRes is handled
Assistant
Now let me look at pages-page-data.ts to understand how gsspRes is created:
Assistant
Now let me look at the dev server's handling of gssp to see if it has the same issue
Assistant
Let me look at how gsspExtraHeaders are used later in the dev-server:
Assistant
Let me also check the pages-data-route.ts for similar issues
Assistant
Let me look at how the existing tests are structured for pages router, and find if there are fixtures I can use.
Assistant
Let me look at the existing pages-page-response test
Assistant
Let me look at how
createGsspReqResis implementedAssistant
Let me look at pages-node-compat.ts for the req/res creation
Assistant
Let me check the compiled version of the pages-server-entry to see the actual runtime behavior:
Assistant
So the compiled code accesses
gsspRes.headersdirectly. But fromcreatePagesReqRes, theresobject doesn't have aheadersproperty. So either:- The compiled code has a different implementation, or
- The
gsspRescomes from a different source
Let me check the dist version of createPagesReqRes.
Actually, wait. Let me check pages-page-data.ts more carefully:
type PagesPagePropsResult = { props?: Record<string, unknown>; redirect?: PagesRedirectResult; notFound?: boolean; revalidate?: number; };And
gsspResis:let gsspRes: PagesMutableGsspResponse | null = null;And
PagesMutableGsspResponse:export type PagesMutableGsspResponse = { headersSent: boolean; } & PagesGsspResponse;And
PagesGsspResponse:export type PagesGsspResponse = { statusCode: number; getHeaders(): Record<string, string | number | boolean | string[]>; };So
PagesMutableGsspResponsedoesn't have aheadersproperty. Theresobject increatePagesReqResalso doesn't have aheadersproperty.So
gsspRes.headersin pages-server-entry.ts would beundefined, and the conditionif (gsspRes && gsspRes.headers)would be false.But wait - that's the source code, and the dist might be compiled from it. Let me check the dist version of createPagesReqRes.
Assistant
Let me check the dist version of pages-page-data.js for gsspRes handling
Assistant
Let me check the full context around line 642 in the dist pages-server-entry
Assistant
Now I have a clear understanding. Let me implement the fix. First, let me look at the exact code around the Cache-Control logic in
pages-page-response.ts:Assistant
Now I have a clear understanding. Let me implement the fix. The issue is that in
pages-page-response.ts, when neitherscriptNoncenorisrRevalidateSecondsare set, noCache-Controlheader is emitted for gssp pages. The fix is to add a defaultCache-Controlheader.Let me first implement the fix in `pages-page-response
Assistant
Let me open the file first.
Assistant
Now let me go to the relevant lines and make the edit:
Assistant
Now let me edit the file to add the default Cache-Control for gssp pages.
Assistant
Good, the edit is applied. Now let me fix the dev-server.ts. Let me open it and find the relevant section.
Assistant
Let me go to the relevant section around line 1058:
Assistant
Now let me edit the dev-server.ts to add the default Cache-Control.
Assistant
Now let me also check the data request path in the pages-server-entry. Let me look at it:
Assistant
Let me also fix the data request path. The
gsspRes.headersshould begsspRes.getHeaders()sincegsspResis aPagesGsspResponsewhich only hasgetHeaders(), not a directheadersproperty.Assistant
Let me find the data request section in this file:
Assistant
Let me look at the context around line 714:
Assistant
I see the issue -
gsspRes.headersshould begsspRes.getHeaders()since theresobject fromcreatePagesReqResdoesn't have a directheadersproperty. Let me also add the default Cache-Control for data requests:Assistant
There's a duplication. Let me fix it:
Assistant
Now let me verify the changes work by running the existing tests. Let me first check how to run tests:
Assistant
Let me run the pages-page-response tests:
Assistant
All 9 tests pass. Let me also run the related tests:
Assistant
Now let me also add the default Cache-Control to the data request path. Let me update the pages-server-entry.ts:
Assistant
Let me check the dev server's data request path:
Assistant
Let me look at the dev server's data request path around line 856:
Assistant
I need to also fix the dev server's data request path. Let me edit it:
Assistant
Now let me edit the dev server's data request path to add the default Cache-Control:
Assistant
There's a duplicate closing brace. Let me fix
Assistant
I see the blank line before the comment was lost. Let me add it back:
Assistant
Good. Now let me run all the unit tests to verify nothing is broken:
Assistant
Let me check which tests failed to see if they're related to my changes:
Assistant
Let me see which test files failed:
Assistant
Let me run the tests with a different approach to see the failures more clearly:
Assistant
Let me check if these failures were pre-existing by running the specific tests that might be affected by my changes:
Assistant
Let me check if the failures are pre-existing by looking at the specific failed
Assistant
Let me run the tests and capture the failing file names:
Assistant
Let me capture the output to a file:
Assistant
The failures are caused by my changes - I used TypeScript syntax in generated JavaScript code. Let me fix this.
Assistant
I need to remove TypeScript annotations since this is generated JavaScript code. Let me fix
Assistant
Wait, I'm in the wrong file. Let me check what file I'm editing and open the correct one:
Assistant
Let me go to the data request section:
Assistant
I need to fix this - it still has TypeScript syntax. This is generated JavaScript, so I need plain JS. Let me fix:
Assistant
Now let me verify the dev-server.ts is intact and check the problematic edit:
Assistant
Let me verify the two key sections in dev
Assistant
Let me check the relevant lines directly
Assistant
Good, both fixes are in place. Let me run the tests again to see if the TypeScript issue is fixed
Assistant
Good. Now let me run the previously failing tests
Assistant
There's a syntax error in dev-server.ts. Let me find the issue
Assistant
Let me check more context around the error
Assistant
Let me check the git diff to see all changes I made
Assistant
I see the issue - the dev-server.ts got corrupted by a misapplied edit. Let me revert it and re-apply only the intended changes.
Assistant
Now let me re-apply the dev-server.ts changes correctly. First, the data request path:
Assistant
Now let me fix the data request path:
Assistant
Now let me find and fix the HTML response path (extraHeaders):
Assistant
Now let me add the default Cache-Control for the HTML response path:
Assistant
Now let me verify the overall diff is correct:
Assistant
Good, the diff is clean now. Let me run all unit tests again
Assistant
All tests pass! Let me verify the final diff:
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
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →