-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[HOLD - Q4 Release] Add caching and Cache-Control header guidance to Web Deployment documentation #13825
Copy link
Copy link
Open
Labels
act.await-dev-prNeeds dev PR to merge before merging docsNeeds dev PR to merge before merging docsd.new-featureAdds new Flutter contentAdds new Flutter contentdev.deploymentRelates to deploying Flutter app section of Flutter.devRelates to deploying Flutter app section of Flutter.devfrom.teamReported by Dash docs team memberReported by Dash docs team memberp2-mediumNecessary but not urgent concern. Resolve when possible.Necessary but not urgent concern. Resolve when possible.st.blockedIssue cannot continue until another action completesIssue cannot continue until another action completestarget.webTarget apps on the web platformTarget apps on the web platform
Description
Activity
Metadata
Metadata
Assignees
Labels
act.await-dev-prNeeds dev PR to merge before merging docsNeeds dev PR to merge before merging docsd.new-featureAdds new Flutter contentAdds new Flutter contentdev.deploymentRelates to deploying Flutter app section of Flutter.devRelates to deploying Flutter app section of Flutter.devfrom.teamReported by Dash docs team memberReported by Dash docs team memberp2-mediumNecessary but not urgent concern. Resolve when possible.Necessary but not urgent concern. Resolve when possible.st.blockedIssue cannot continue until another action completesIssue cannot continue until another action completestarget.webTarget apps on the web platformTarget apps on the web platform
Warning
DO NOT WORK ON OR MERGE THIS DOC ISSUE YET.
This issue tracks documentation updates for the experimental
--web-content-hashfeature in Flutter Web (Umbrella Issue: flutter/flutter#149031).Implementation is currently in Phase 1 (executable entrypoints only). Do not draft or merge documentation updates on
docs.flutter.devuntil the upcoming Q4 stable release is finalized and the feature has matured.Page URL
https://docs.flutter.dev/deployment/web
Problem
With the introduction of content-hashed web entrypoints in the Flutter build system (
flutter build web --web-content-hash, flutter/flutter#149031), the Flutter Web deployment guide will need guidance on configuring web server and CDNCache-Controlresponse headers.Without explicit server header configuration:
index.htmlorflutter_bootstrap.jswith long-term cache headers causes browsers to retain stale application manifests across deployments.Cache-Control: immutableforces redundant network revalidations on every user visit.Proposed Content
Add a dedicated "Web server and CDN caching configuration" section to https://docs.flutter.dev/deployment/web covering:
Bootstrap & Manifest Files (Revalidate):
index.html,flutter_bootstrap.js,manifest.json,version.jsonCache-Control: no-cache, must-revalidate(ormax-age=0, must-revalidate)Hashed Executable Binaries (Immutable):
main.dart.<hash>.js,main.dart.<hash>.wasm,main.dart.<hash>.mjs,main.dart.<hash>.js.map,main.dart.<hash>.mjs.mapCache-Control: public, max-age=31536000, immutableUnhashed Static Assets & Wasm Source Maps (Moderate TTL):
assets/*,canvaskit/*,flutter.js, andmain.dart.wasm.mapCache-Control: public, max-age=3600, must-revalidate(or appropriate CDN cache profile)Example Hosting Configurations:
firebase.jsonheaders block, Netlify_headers, and Nginx server blocks).