Service Worker by Patrik

Caching Files with Service Worker - Network only

This is the correct approach for things that can't be performed offline, such as analytics pings and non-GET requests. Again, you don't often need to handle this case specifically and the cache falling back to network approach will often be more appropriate.

self.addEventListener('fetch', function(event) {
 event.respondWith(fetch(event.request));
});

Alternatively, simply don't call event.respondWith, which will result in default browser behaviour.

https://developers.google.com/web/ilt/pwa/caching-files-with-service-worker#network_only

Comments