@@ -290,22 +290,16 @@ class CompilerServer {
290
290
if (isEntryPage) compiler._runAgain ();
291
291
292
292
// To help browsers cache resources that don't change, we serve these
293
- // resources under a path containing their hash:
294
- // /cached/{hash}/{path-to-file.js}
295
- bool isCached = segments.length > 1 && segments[0 ] == 'cached' ;
296
- if (isCached) {
297
- // Changing the request lets us record that the hash prefix is handled
298
- // here, and that the underlying handler should use the rest of the url to
299
- // determine where to find the resource in the file system.
300
- request = request.change (path: path.join ('cached' , segments[1 ]));
301
- }
293
+ // resources by adding a query parameter containing their hash:
294
+ // /{path-to-file.js}?____cached={hash}
295
+ var hash = request.url.queryParameters['____cached' ];
302
296
var response = handler (request);
303
- var policy = isCached ? 'max-age=${24 * 60 * 60 }' : 'no-cache' ;
297
+ var policy = hash != null ? 'max-age=${24 * 60 * 60 }' : 'no-cache' ;
304
298
var headers = {'cache-control' : policy};
305
- if (isCached ) {
299
+ if (hash != null ) {
306
300
// Note: the cache-control header should be enough, but this doesn't hurt
307
301
// and can help renew the policy after it expires.
308
- headers['ETag' ] = segments[ 1 ] ;
302
+ headers['ETag' ] = hash ;
309
303
}
310
304
return response.change (headers: headers);
311
305
};
0 commit comments