Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
092df0f1
Commit
092df0f1
authored
Jul 29, 2025
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support experimental.validateRSCRequestHeaders for runtime prefetches
parent
63e373bf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
240 additions
and
107 deletions
+240
-107
page.tsx
.../e2e/app-dir/segment-cache/cdn-cache-busting/app/page.tsx
+32
-10
cdn-cache-busting.test.ts
...segment-cache/cdn-cache-busting/cdn-cache-busting.test.ts
+192
-85
server.mjs
test/e2e/app-dir/segment-cache/cdn-cache-busting/server.mjs
+8
-4
router-act.ts
test/e2e/app-dir/segment-cache/router-act.ts
+8
-8
No files found.
test/e2e/app-dir/segment-cache/cdn-cache-busting/app/page.tsx
View file @
092df0f1
...
@@ -2,15 +2,37 @@ import { LinkAccordion } from '../components/link-accordion'
...
@@ -2,15 +2,37 @@ import { LinkAccordion } from '../components/link-accordion'
export
default
function
Page
()
{
export
default
function
Page
()
{
return
(
return
(
<
ul
>
<
div
>
<
li
>
<
h2
>
auto prefetches
</
h2
>
<
LinkAccordion
href=
"/target-page"
>
Target page
</
LinkAccordion
>
<
ul
id=
"prefetch-auto"
>
</
li
>
<
li
>
<
li
>
<
LinkAccordion
href=
"/target-page"
>
Target page
</
LinkAccordion
>
<
LinkAccordion
href=
"/redirect-to-target-page"
>
</
li
>
Redirects to target page
<
li
>
</
LinkAccordion
>
<
LinkAccordion
href=
"/redirect-to-target-page"
>
</
li
>
Redirects to target page
</
ul
>
</
LinkAccordion
>
</
li
>
</
ul
>
{
process
.
env
.
__NEXT_CACHE_COMPONENTS
&&
(
// runtime prefetches are only available if cacheComponents is enabled.
<>
<
h2
>
runtime prefetches
</
h2
>
<
ul
id=
"prefetch-runtime"
>
<
li
>
<
LinkAccordion
href=
"/target-page"
prefetch=
{
true
}
>
Target page
</
LinkAccordion
>
</
li
>
<
li
>
<
LinkAccordion
href=
"/redirect-to-target-page"
prefetch=
{
true
}
>
Redirects to target page
</
LinkAccordion
>
</
li
>
</
ul
>
</>
)
}
</
div
>
)
)
}
}
test/e2e/app-dir/segment-cache/cdn-cache-busting/cdn-cache-busting.test.ts
View file @
092df0f1
This diff is collapsed.
Click to expand it.
test/e2e/app-dir/segment-cache/cdn-cache-busting/server.mjs
View file @
092df0f1
...
@@ -135,11 +135,15 @@ async function createFakeCDN(destPort) {
...
@@ -135,11 +135,15 @@ async function createFakeCDN(destPort) {
}
}
resolveCDNEntry
(
entry
)
resolveCDNEntry
(
entry
)
})
})
return
}
else
{
// If the response isn't cacheable, pipe it through to the client.
res
.
writeHead
(
proxyRes
.
statusCode
||
200
,
proxyRes
.
statusMessage
,
proxyRes
.
headers
)
proxyRes
.
pipe
(
res
)
}
}
// If the response isn't cacheable, pipe it through to the client.
proxyRes
.
pipe
(
res
)
return
})
})
return
cdnServer
return
cdnServer
...
...
test/e2e/app-dir/segment-cache/router-act.ts
View file @
092df0f1
...
@@ -159,7 +159,7 @@ export function createRouterAct(
...
@@ -159,7 +159,7 @@ export function createRouterAct(
// `act` controls the timing of when responses reach the client,
// `act` controls the timing of when responses reach the client,
// but it should not affect the timing of when requests reach the
// but it should not affect the timing of when requests reach the
// server; we pass the request to the server the immediately.
// server; we pass the request to the server the immediately.
result
:
new
Promise
(
async
(
resolve
)
=>
{
result
:
(
async
(
)
=>
{
const
originalResponse
=
await
page
.
request
.
fetch
(
request
,
{
const
originalResponse
=
await
page
.
request
.
fetch
(
request
,
{
maxRedirects
:
0
,
maxRedirects
:
0
,
})
})
...
@@ -172,13 +172,13 @@ export function createRouterAct(
...
@@ -172,13 +172,13 @@ export function createRouterAct(
const
headers
=
originalResponse
.
headers
()
const
headers
=
originalResponse
.
headers
()
delete
headers
[
'transfer-encoding'
]
delete
headers
[
'transfer-encoding'
]
re
solve
(
{
re
turn
{
text
:
await
originalResponse
.
text
(),
text
:
await
originalResponse
.
text
(),
body
:
await
originalResponse
.
body
(),
body
:
await
originalResponse
.
body
(),
headers
,
headers
,
status
:
originalResponse
.
status
(),
status
:
originalResponse
.
status
(),
}
)
}
}),
})
()
,
didProcess
:
false
,
didProcess
:
false
,
})
})
if
(
onDidIssueFirstRequest
!==
null
)
{
if
(
onDidIssueFirstRequest
!==
null
)
{
...
@@ -417,14 +417,14 @@ ${fulfilled.body}
...
@@ -417,14 +417,14 @@ ${fulfilled.body}
batch
.
pendingRequests
.
add
({
batch
.
pendingRequests
.
add
({
url
:
req
.
url
(),
url
:
req
.
url
(),
route
:
null
,
route
:
null
,
result
:
new
Promise
(
async
(
resolve
)
=>
{
result
:
(
async
(
)
=>
{
re
solve
(
{
re
turn
{
text
:
await
res
.
text
(),
text
:
await
res
.
text
(),
body
:
await
res
.
body
(),
body
:
await
res
.
body
(),
headers
:
res
.
headers
(),
headers
:
res
.
headers
(),
status
:
res
.
status
(),
status
:
res
.
status
(),
}
)
}
}),
})
()
,
didProcess
:
false
,
didProcess
:
false
,
})
})
page
.
off
(
'response'
,
handleResponse
)
page
.
off
(
'response'
,
handleResponse
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment