Typical Expiration / Cache Directives for Websites
Expire static content a week or more into the future.
In .htaccess
# Turn on the module.
ExpiresActive on
# Set the default expiry times.
ExpiresDefault "now"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/svg+xml "access 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/ico "access plus 1 month"
ExpiresByType text/html "access plus 600 seconds"
What about site updates?
Cache/Expiration based on full URL. So you can reflect the "version" within the URL, either as part of the path or part of the query string.
- Unique "version" content in query string
https://www[...]/site.min.css?ver=f1b2b77c823860edee8f0d253d01aaed
orhttps://www[...]/site.css?ver=20230701
- versioning as part of path
- Leaflet 1.9.4:
https://unpkg.com/leaflet@1.9.4/dist/leaflet.js
- Leaflet 1.8.0:
https://unpkg.com/leaflet@1.8.0/dist/leaflet.js
- Leaflet 1.9.4: