Unverified Commit c367c72d authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Disable cache for rsc pages (#33438)

Co-authored-by: 's avatarkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent 45eb137a
......@@ -6,6 +6,7 @@ import { toNodeHeaders } from '../../../../server/web/utils'
const createHeaders = (args?: any) => ({
...args,
'x-middleware-ssr': '1',
'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate',
})
function sendError(req: any, error: Error) {
......
......@@ -357,6 +357,18 @@ async function runBasicTests(context, env) {
expect(pathNotFoundHTML).toContain(page404Content)
})
it('should disable cache for RSC pages', async () => {
const urls = ['/', '/next-api/image', '/next-api/link']
await Promise.all(
urls.map(async (url) => {
const { headers } = await fetchViaHTTP(context.appPort, url)
expect(headers.get('cache-control')).toBe(
'no-cache, no-store, max-age=0, must-revalidate'
)
})
)
})
it('should support next/link', async () => {
const linkHTML = await renderViaHTTP(context.appPort, '/next-api/link')
const $ = cheerio.load(linkHTML)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment