Skip to content

Commit

Permalink
Force Vercel to create separate cache entries for RSC & HTML responses
Browse files Browse the repository at this point in the history
By specifying two different destinations (`/` and `/index`) that point to the same edge function we can apparently separate the RSC response cache from the HTML response cache (based on the `accept` header).

Motivated by https://github.com/vercel/vercel/blob/732ac2072cd1c09e383d7da2f671c3bb430c8a8a/packages/next/src/server-build.ts#L1466-L1497
  • Loading branch information
unstubbable committed Apr 13, 2023
1 parent 61e902c commit f13f24a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/vercel-app/src/config.json
Expand Up @@ -14,11 +14,16 @@
"src": "/_vercel/insights/(.*)",
"dest": "https://vitals.vercel-insights.com/v1/$1"
},
{
"src": "/.*",
"dest": "/index",
"has": [{"type": "header", "key": "accept", "value": "text/x-component"}],
"headers": {"vary": "accept"}
},
{
"src": "/.*",
"dest": "/",
"headers": {"vary": "accept"},
"override": true
"headers": {"vary": "accept"}
}
]
}

0 comments on commit f13f24a

Please sign in to comment.