mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Serve non-cacheable files with a max-age of 0 instead of a day
We previously served non-cacheable files with a max-age of a day. This was done to avoid image flickering on page reload (see #773). As far as I can tell, image flickering still occurs because `location.reload` always forces validation. But switching to `location.replace` means that max-age will actually be respected, and we don't want to cache these assets for a day because then changes would not be visible on reloads.
This commit is contained in:
@@ -367,17 +367,9 @@ WebAppInternals.staticFilesMiddleware = function (staticFiles, req, res, next) {
|
||||
// Cacheable files are files that should never change. Typically
|
||||
// named by their hash (eg meteor bundled js and css files).
|
||||
// We cache them ~forever (1yr).
|
||||
//
|
||||
// We cache non-cacheable files anyway. This isn't really correct, as users
|
||||
// can change the files and changes won't propagate immediately. However, if
|
||||
// we don't cache them, browsers will 'flicker' when rerendering
|
||||
// images. Eventually we will probably want to rewrite URLs of static assets
|
||||
// to include a query parameter to bust caches. That way we can both get
|
||||
// good caching behavior and allow users to change assets without delay.
|
||||
// https://github.com/meteor/meteor/issues/773
|
||||
var maxAge = info.cacheable
|
||||
? 1000 * 60 * 60 * 24 * 365
|
||||
: 1000 * 60 * 60 * 24;
|
||||
: 0;
|
||||
|
||||
// Set the X-SourceMap header, which current Chrome, FireFox, and Safari
|
||||
// understand. (The SourceMap header is slightly more spec-correct but FF
|
||||
|
||||
Reference in New Issue
Block a user