Installing cache in files in Firebase storage

My PWA runs on Firebase. My image files are hosted on Firebase Storage. I noticed that my browser does not save the cache for files downloaded from the storage system. The browser requests files for each page refresh. This causes unnecessary delay and traffic.

Network stats

My JS script downloads files via the Firebase Storage download link, for example: https://firebasestorage.googleapis.com/v0/b/discipulado-7b14b.appspot.com/o/book3.png?alt=media&token=65b2cde7-c8a4 -45da-a743-401759663c17 .

Can I cache these requests?

UPDATE

, Firebase Storage . . ?

+9
4

, , workbox cacheFirst . , , .

, Firebase, , cacheControl Firebase Hosting Cache-Control .

0

Serviceworker .

URL .

, .

-

cacheUrl = url.origin + url.pathname.substr(0, url.pathname.length - urlPath.length) + urlPath;

cache.put(cacheUrl, response);

0

Source: https://habr.com/ru/post/1677729/


All Articles