Skip to content

Remove devCacheControlNoCache experimental option (hard-code no-cache)#91503

Merged
sokra merged 4 commits into
canaryfrom
sokra/dev-cache-control-no-cache-default
Mar 17, 2026
Merged

Remove devCacheControlNoCache experimental option (hard-code no-cache)#91503
sokra merged 4 commits into
canaryfrom
sokra/dev-cache-control-no-cache-default

Conversation

@sokra
Copy link
Copy Markdown
Member

@sokra sokra commented Mar 17, 2026

What?

Removes the experimental.devCacheControlNoCache config option entirely and hard-codes no-cache, must-revalidate as the dev server Cache-Control header value.

Previously the option controlled whether the dev server responded with:

  • no-store, must-revalidate (default, false)
  • no-cache, must-revalidate (opt-in, true)

This PR first flips the default to true, then removes the option altogether — making no-cache, must-revalidate unconditional in all dev code paths.

Why?

no-cache is strictly better than no-store for the dev server:

  • no-cache allows the browser to revalidate (conditional If-None-Match/If-Modified-Since requests), letting the server respond with 304 Not Modified when nothing changed → faster page loads during development.
  • no-store forces a full re-fetch every time, discarding valid cached responses.

Since no-cache is the correct behavior for all dev users, the toggle has no remaining value and can be removed to simplify the codebase.

How?

Two commits:

  1. bcec825 — Flip the default from falsetrue; update tests/fixtures/manifest to reflect the new default.

  2. e6e919f — Remove the option entirely:

    • Deleted devCacheControlNoCache?: boolean from ExperimentalConfig interface, config-schema.ts Zod schema, defaultConfig, NextConfigRuntime, and getNextConfigRuntime().
    • Replaced all four conditional ternaries in base-server.ts, router-server.ts, pages-handler.ts, and app-page.ts with the hard-coded string 'no-cache, must-revalidate'.
    • Deleted the dev-cache-control-no-cache-disabled test suite (was testing the false path which no longer exists).
    • Simplified the remaining dev-cache-control-no-cache test (removed experimental framing).
    • Synced rspack-dev-tests-manifest.json.

@nextjs-bot
Copy link
Copy Markdown
Contributor

nextjs-bot commented Mar 17, 2026

Tests Passed

@nextjs-bot
Copy link
Copy Markdown
Contributor

nextjs-bot commented Mar 17, 2026

Stats from current PR

✅ No significant changes detected

📊 All Metrics
📖 Metrics Glossary

Dev Server Metrics:

  • Listen = TCP port starts accepting connections
  • First Request = HTTP server returns successful response
  • Cold = Fresh build (no cache)
  • Warm = With cached build artifacts

Build Metrics:

  • Fresh = Clean build (no .next directory)
  • Cached = With existing .next directory

Change Thresholds:

  • Time: Changes < 50ms AND < 10%, OR < 2% are insignificant
  • Size: Changes < 1KB AND < 1% are insignificant
  • All other changes are flagged to catch regressions

⚡ Dev Server

Metric Canary PR Change Trend
Cold (Listen) 505ms 456ms █▁▁▁▁
Cold (Ready in log) 464ms 453ms █▁▁▁▁
Cold (First Request) 847ms 858ms █▃▁▃▃
Warm (Listen) 457ms 456ms █▁▁▁▁
Warm (Ready in log) 449ms 449ms █▁▁▁▁
Warm (First Request) 355ms 351ms █▁▁▁▁
📦 Dev Server (Webpack) (Legacy)

📦 Dev Server (Webpack)

Metric Canary PR Change Trend
Cold (Listen) 609ms 607ms ▁▁▁█▅
Cold (Ready in log) 570ms 564ms ▃▁▃█▂
Cold (First Request) 2.630s 2.675s ▁▁▂█▄
Warm (Listen) 610ms 608ms ▁▁▁█▅
Warm (Ready in log) 575ms 569ms ▃▁▃█▂
Warm (First Request) 2.693s 2.729s ▂▁▂█▄

⚡ Production Builds

Metric Canary PR Change Trend
Fresh Build 4.215s 4.105s █▁▁▁▁
Cached Build 4.018s 4.015s █▁▁▁▁
📦 Production Builds (Webpack) (Legacy)

📦 Production Builds (Webpack)

Metric Canary PR Change Trend
Fresh Build 19.112s 19.162s ▁▁▁█▅
Cached Build 19.207s 19.211s ▁▁▁█▅
node_modules Size 483 MB 483 MB █████
📦 Bundle Sizes

Bundle Sizes

⚡ Turbopack

Client

Main Bundles
Canary PR Change
0_9s6iwj6k~rx.js gzip 164 B N/A -
0.aneqbzty2y~.js gzip 155 B N/A -
0~lwfcrlb4v_9.css gzip 115 B 115 B
00h0nz7r436~l.js gzip 13.3 kB N/A -
019g6dx8~tg3j.js gzip 12.9 kB N/A -
02ku7edzc_wf7.js gzip 450 B N/A -
03~yq9q893hmn.js gzip 39.4 kB 39.4 kB
08r-0b6qc7o_s.js gzip 163 B N/A -
092lcb3fqrrf9.js gzip 8.52 kB N/A -
09smvgt.j8lqk.js gzip 158 B N/A -
0aj~xs1l1g8tg.js gzip 8.53 kB N/A -
0al442x9i7k8y.js gzip 157 B N/A -
0c2g.labu7dli.js gzip 65.7 kB N/A -
0e9ag~d9m7paf.js gzip 48.5 kB N/A -
0eg78sqvyqa0_.js gzip 13.7 kB N/A -
0fn2sqti3knsv.js gzip 158 B N/A -
0g9v2.jawbmzg.js gzip 159 B N/A -
0h35gmp9u328z.js gzip 8.54 kB N/A -
0h6fkavebp.iz.js gzip 8.47 kB N/A -
0ino_yf1k3h6k.js gzip 10.4 kB N/A -
0j_v.bmk6mt~t.js gzip 169 B N/A -
0js9pqs~wxj61.js gzip 157 B N/A -
0lpm0ynr-5028.js gzip 7.61 kB N/A -
0moy~uao4dl.m.js gzip 9.19 kB N/A -
0q50rtpusjy90.js gzip 2.28 kB N/A -
0smgy2grrrlka.js gzip 8.58 kB N/A -
0t1dzhdfh0txh.js gzip 215 B 215 B
0vadx5e5wcx6e.js gzip 160 B N/A -
0vt7pofxnk8in.js gzip 10.1 kB N/A -
0ya.4ltkyn.f6.js gzip 157 B N/A -
0zid7o0-vupvp.js gzip 225 B N/A -
0zmcxx2g36e31.js gzip 156 B N/A -
11yo3xfd6b147.js gzip 12.9 kB N/A -
12pz54pfp78.js gzip 70.8 kB N/A -
13.84hqxl_1p7.js gzip 9.76 kB N/A -
13c7ilxu5y4u7.js gzip 156 B N/A -
1554wr-t7p6z-.js gzip 8.55 kB N/A -
15tjst79~qy3_.js gzip 1.46 kB N/A -
15z_v00ne4ud0.js gzip 8.47 kB N/A -
17d_m3p4j9w6r.js gzip 5.62 kB N/A -
17yu~3yiu7d2m.js gzip 8.52 kB N/A -
turbopack-0_..c11g.js gzip 4.16 kB N/A -
turbopack-00..ag6r.js gzip 4.17 kB N/A -
turbopack-01..lvav.js gzip 4.16 kB N/A -
turbopack-06..i1bm.js gzip 4.16 kB N/A -
turbopack-07..rk7h.js gzip 4.16 kB N/A -
turbopack-09..fln6.js gzip 4.16 kB N/A -
turbopack-09..jsr..js gzip 4.16 kB N/A -
turbopack-0a..-0x1.js gzip 4.16 kB N/A -
turbopack-0b..pgqz.js gzip 4.16 kB N/A -
turbopack-0c..l8f-.js gzip 4.16 kB N/A -
turbopack-0g..o_r8.js gzip 4.16 kB N/A -
turbopack-0n..a~rr.js gzip 4.14 kB N/A -
turbopack-0t..hi_v.js gzip 4.16 kB N/A -
turbopack-17..hse~.js gzip 4.16 kB N/A -
0-1zv_npagc74.js gzip N/A 155 B -
022tz.thp2xh9.js gzip N/A 159 B -
03t__~.5lvgeu.js gzip N/A 5.62 kB -
04bxr0_5bknd3.js gzip N/A 169 B -
04d6ll75jqx3r.js gzip N/A 9.19 kB -
0583exyh-yhc7.js gzip N/A 9.76 kB -
05mtz1zx7h6.2.js gzip N/A 153 B -
072lv63r8dcz~.js gzip N/A 8.58 kB -
07k6dcww5s4pu.js gzip N/A 13.7 kB -
0ar1~bwpezfgw.js gzip N/A 13.3 kB -
0ba6afob5o5i2.js gzip N/A 157 B -
0bbiz~3nzyuc_.js gzip N/A 156 B -
0bpt14u_xx9nq.js gzip N/A 158 B -
0c99mq1ez2bke.js gzip N/A 450 B -
0cq-cmde_ws6u.js gzip N/A 8.47 kB -
0fwf102w10o9~.js gzip N/A 8.52 kB -
0gtmn.q_j1v5r.js gzip N/A 10.4 kB -
0h5~v-tahitcf.js gzip N/A 10.1 kB -
0le9gtymglk8m.js gzip N/A 65.7 kB -
0nclq9z6yzzm5.js gzip N/A 1.46 kB -
0nzumcogektg7.js gzip N/A 8.55 kB -
0qzmotnmm-5gl.js gzip N/A 156 B -
0s.c-cn5eebrx.js gzip N/A 8.47 kB -
0s6.ndj~wg5qp.js gzip N/A 70.8 kB -
0tna7lg6q4zne.js gzip N/A 12.9 kB -
0ujw1xd4ww4ty.js gzip N/A 156 B -
0votdfxr5fb5u.js gzip N/A 2.28 kB -
0ykl9bs_qj.5..js gzip N/A 8.52 kB -
0zfen0tnxp4gh.js gzip N/A 8.55 kB -
0zjm8qnb56ozp.js gzip N/A 48.4 kB -
106nfjop2t.ze.js gzip N/A 157 B -
10ad2y_.gbnx1.js gzip N/A 158 B -
10wkq1h9jzkg..js gzip N/A 225 B -
13t.tli.rsary.js gzip N/A 162 B -
149ndfh8zfcaz.js gzip N/A 8.53 kB -
15gkb_10omqgr.js gzip N/A 13 kB -
168xlbkju2cj0.js gzip N/A 7.6 kB -
18cocjao46v.j.js gzip N/A 154 B -
turbopack-0~..c-3p.js gzip N/A 4.16 kB -
turbopack-08..4mg..js gzip N/A 4.16 kB -
turbopack-08..6xuc.js gzip N/A 4.16 kB -
turbopack-0b..u1w2.js gzip N/A 4.17 kB -
turbopack-0e..~lew.js gzip N/A 4.16 kB -
turbopack-0j..55~9.js gzip N/A 4.16 kB -
turbopack-0s..vzka.js gzip N/A 4.16 kB -
turbopack-0x..h832.js gzip N/A 4.16 kB -
turbopack-0z..rrmw.js gzip N/A 4.16 kB -
turbopack-10..e9-d.js gzip N/A 4.16 kB -
turbopack-11..qdil.js gzip N/A 4.14 kB -
turbopack-13..3gna.js gzip N/A 4.16 kB -
turbopack-13..yk9n.js gzip N/A 4.16 kB -
turbopack-13..cut-.js gzip N/A 4.16 kB -
Total 463 kB 463 kB ✅ -63 B

Server

Middleware
Canary PR Change
middleware-b..fest.js gzip 711 B 712 B
Total 711 B 712 B ⚠️ +1 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 426 B 431 B 🔴 +5 B (+1%)
Total 426 B 431 B ⚠️ +5 B

📦 Webpack

Client

Main Bundles
Canary PR Change
5528-HASH.js gzip 5.54 kB N/A -
6280-HASH.js gzip 60.3 kB N/A -
6335.HASH.js gzip 169 B N/A -
912-HASH.js gzip 4.59 kB N/A -
e8aec2e4-HASH.js gzip 62.7 kB N/A -
framework-HASH.js gzip 59.7 kB 59.7 kB
main-app-HASH.js gzip 255 B 253 B
main-HASH.js gzip 39.2 kB 39.2 kB
webpack-HASH.js gzip 1.68 kB 1.68 kB
262-HASH.js gzip N/A 4.59 kB -
2889.HASH.js gzip N/A 169 B -
5602-HASH.js gzip N/A 5.55 kB -
6948ada0-HASH.js gzip N/A 62.7 kB -
9544-HASH.js gzip N/A 60.9 kB -
Total 234 kB 235 kB ⚠️ +658 B
Polyfills
Canary PR Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Total 39.4 kB 39.4 kB
Pages
Canary PR Change
_app-HASH.js gzip 194 B 194 B
_error-HASH.js gzip 183 B 180 B 🟢 3 B (-2%)
css-HASH.js gzip 331 B 330 B
dynamic-HASH.js gzip 1.81 kB 1.81 kB
edge-ssr-HASH.js gzip 256 B 256 B
head-HASH.js gzip 351 B 352 B
hooks-HASH.js gzip 384 B 383 B
image-HASH.js gzip 580 B 581 B
index-HASH.js gzip 260 B 260 B
link-HASH.js gzip 2.51 kB 2.51 kB
routerDirect..HASH.js gzip 320 B 319 B
script-HASH.js gzip 386 B 386 B
withRouter-HASH.js gzip 315 B 315 B
1afbb74e6ecf..834.css gzip 106 B 106 B
Total 7.98 kB 7.98 kB ✅ -1 B

Server

Edge SSR
Canary PR Change
edge-ssr.js gzip 125 kB 125 kB
page.js gzip 269 kB 268 kB
Total 394 kB 393 kB ✅ -335 B
Middleware
Canary PR Change
middleware-b..fest.js gzip 619 B 614 B
middleware-r..fest.js gzip 156 B 155 B
middleware.js gzip 43.9 kB 44.1 kB
edge-runtime..pack.js gzip 842 B 842 B
Total 45.5 kB 45.7 kB ⚠️ +208 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 715 B 718 B
Total 715 B 718 B ⚠️ +3 B
Build Cache
Canary PR Change
0.pack gzip 4.27 MB 4.26 MB 🟢 5.82 kB (0%)
index.pack gzip 110 kB 110 kB
index.pack.old gzip 110 kB 111 kB
Total 4.49 MB 4.48 MB ✅ -6.14 kB

🔄 Shared (bundler-independent)

Runtimes
Canary PR Change
app-page-exp...dev.js gzip 333 kB 333 kB
app-page-exp..prod.js gzip 181 kB 181 kB
app-page-tur...dev.js gzip 333 kB 333 kB
app-page-tur..prod.js gzip 181 kB 181 kB
app-page-tur...dev.js gzip 329 kB 329 kB
app-page-tur..prod.js gzip 179 kB 179 kB
app-page.run...dev.js gzip 329 kB 329 kB
app-page.run..prod.js gzip 179 kB 179 kB
app-route-ex...dev.js gzip 76 kB 76 kB
app-route-ex..prod.js gzip 51.7 kB 51.7 kB
app-route-tu...dev.js gzip 76 kB 76 kB
app-route-tu..prod.js gzip 51.7 kB 51.7 kB
app-route-tu...dev.js gzip 75.6 kB 75.6 kB
app-route-tu..prod.js gzip 51.5 kB 51.5 kB
app-route.ru...dev.js gzip 75.6 kB 75.6 kB
app-route.ru..prod.js gzip 51.5 kB 51.5 kB
dist_client_...dev.js gzip 324 B 324 B
dist_client_...dev.js gzip 326 B 326 B
dist_client_...dev.js gzip 318 B 318 B
dist_client_...dev.js gzip 317 B 317 B
pages-api-tu...dev.js gzip 43.4 kB 43.4 kB
pages-api-tu..prod.js gzip 33 kB 33 kB
pages-api.ru...dev.js gzip 43.3 kB 43.3 kB
pages-api.ru..prod.js gzip 33 kB 33 kB
pages-turbo....dev.js gzip 52.7 kB 52.7 kB
pages-turbo...prod.js gzip 38.6 kB 38.6 kB
pages.runtim...dev.js gzip 52.7 kB 52.7 kB
pages.runtim..prod.js gzip 38.6 kB 38.6 kB
server.runti..prod.js gzip 62.4 kB 62.4 kB
Total 2.95 MB 2.95 MB ✅ -30 B
📝 Changed Files (1 file)

Files with changes:

  • server.runtime.prod.js
View diffs
server.runtime.prod.js

Diff too large to display

📎 Tarball URL
https://vercel-packages.vercel.app/next/commits/b7b326452d73157f4a104730523ddc60b5cab541/next

Copy link
Copy Markdown
Contributor

@vercel vercel Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Test at ppr-full.test.ts:195 still expects the old no-store, must-revalidate Cache-Control header, causing test failure in dev mode.

Fix on Vercel

@nextjs-bot
Copy link
Copy Markdown
Contributor

Allow CI Workflow Run

  • approve CI run for commit: 1a02a026b75f97956e4c18cba89df36d96430352

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

sokra and others added 4 commits March 17, 2026 14:38
Makes no-cache, must-revalidate the default dev Cache-Control header.
The disabled test fixture now opts out explicitly with devCacheControlNoCache: false.

Co-Authored-By: Claude <noreply@anthropic.com>
The no-cache, must-revalidate behavior is now unconditional in dev.
Removes the config field, schema entry, type, default, and all
conditional branches. Deletes the disabled test suite and renames
the remaining test to drop the experimental framing.

Co-Authored-By: Claude <noreply@anthropic.com>
Update all tests to expect no-cache instead of no-store in dev mode, and
fix fallback-prefetch to not treat 304 Not Modified as a network error.

Co-Authored-By: Claude <noreply@anthropic.com>
…st-revalidate` Cache-Control header, causing test failure in dev mode.

This commit fixes the issue reported at test/e2e/app-dir/ppr-full/ppr-full.test.ts:195

**Bug analysis:**

The PR removed the `experimental.devCacheControlNoCache` config option and hard-coded the dev server Cache-Control header to `no-cache, must-revalidate` (changed from the old default of `no-store, must-revalidate`). This change was applied across three server files:
- `packages/next/src/server/base-server.ts`
- `packages/next/src/server/route-modules/pages/pages-handler.ts`
- `packages/next/src/server/lib/router-server.ts`

A follow-up commit (716520a) updated numerous tests to expect the new `no-cache, must-revalidate` header value (visible in files like `custom-cache-control.test.ts`, `metadata.test.ts`, `dev-cache-control-no-cache.test.ts`, and `rendering.test.ts`). However, `test/e2e/app-dir/ppr-full/ppr-full.test.ts` at line 195 was missed — it's the **only** remaining instance of `no-store, must-revalidate` across the entire `test/` directory.

When the PPR full test suite runs in dev mode (`isNextDev === true`), it hits this assertion which expects the old `no-store, must-revalidate` header but the dev server now returns `no-cache, must-revalidate`, causing the test to fail.

**Fix:**

Changed line 195 from `expect(cacheControl).toEqual('no-store, must-revalidate')` to `expect(cacheControl).toEqual('no-cache, must-revalidate')` to match the new dev server behavior.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: sokra <tobias.koppers@googlemail.com>
@sokra sokra force-pushed the sokra/dev-cache-control-no-cache-default branch from 1a02a02 to b7b3264 Compare March 17, 2026 14:41
@sokra sokra marked this pull request as ready for review March 17, 2026 19:12
@sokra sokra merged commit 4494261 into canary Mar 17, 2026
281 of 286 checks passed
@sokra sokra deleted the sokra/dev-cache-control-no-cache-default branch March 17, 2026 19:13
@github-actions github-actions Bot added the locked label Apr 1, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants