Skip to content

Commit

Permalink
Add RSC headers of Next.js app directory pages to Hosting headers. (#…
Browse files Browse the repository at this point in the history
…6608)

* check route or page from app path routes manifest

* add pages headers to framework deploy tests
  • Loading branch information
leoortizz authored Dec 12, 2023
1 parent 1c6e5ee commit 3db6a6f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Fix Next.js dynamic and static OG images. (#6592)
- Address a regression introduced in 13.0.1 when emulating Vite applications. (#6599)
- Add RSC headers of Next.js app directory pages to Hosting headers. (#6608)
30 changes: 30 additions & 0 deletions scripts/webframeworks-deploy-tests/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,36 @@ describe("webframeworks", function (this) {
},
],
},
{
headers: [
{
key: "x-next-cache-tags",
value:
"_N_T_/layout,_N_T_/app/layout,_N_T_/app/image/layout,_N_T_/app/image/page,_N_T_/app/image",
},
],
source: "/base/app/image",
},
{
headers: [
{
key: "x-next-cache-tags",
value:
"_N_T_/layout,_N_T_/app/layout,_N_T_/app/ssg/layout,_N_T_/app/ssg/page,_N_T_/app/ssg",
},
],
source: "/base/app/ssg",
},
{
headers: [
{
key: "x-next-cache-tags",
value:
"_N_T_/layout,_N_T_/app/layout,_N_T_/app/isr/layout,_N_T_/app/isr/page,_N_T_/app/isr",
},
],
source: "/base/app/isr",
},
],
cleanUrls: true,
trailingSlash: false,
Expand Down
2 changes: 1 addition & 1 deletion src/frameworks/next/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export async function getHeadersFromMetaFiles(

await Promise.all(
Object.entries(appPathRoutesManifest).map(async ([key, source]) => {
if (basename(key) !== "route") return;
if (!["route", "page"].includes(basename(key))) return;
const parts = source.split("/").filter((it) => !!it);
const partsOrIndex = parts.length > 0 ? parts : ["index"];

Expand Down

0 comments on commit 3db6a6f

Please sign in to comment.