title: Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode
body: <p>I getting this error in my Service Worker. I have a page that changes dynamically with user usage. I do not want to cache my requests. Can someone help me to change my <code>fetch</code> event but still allow me to have a <a href="https://developers.google.com/web/progressive-web-apps/" rel="nofollow noreferrer">progressive webapp</a>?</p>
  
  <p><strong>sw.js</strong></p>
  
  <pre><code>{% load static from staticfiles %}
  'use strict';
  
  this.addEventListener('install', function(event) {
    event.waitUntil(
      caches.open('myapp-v1.0.0.2').then(function(cache) {
        return cache.addAll([
          "/",
        ]);
      })
    );
  });
  
  self.addEventListener('push', function(event) {
    var body_content = JSON.parse(event.data.text());
    var title = body_content.title;
    var options = {
      body: body_content.text,
      icon: body_content.icon,
      badge: body_content.icon,
      data: {
        url: body_content.url
      }
    };
  
    event.waitUntil(self.registration.showNotification(title, options));
  });
  
  self.addEventListener('notificationclick', function(event) {
    event.notification.close();
    event.waitUntil(
      clients.openWindow(event.notification.data.url)
    );
  });
  
  self.addEventListener('fetch', function(event) {
    event.respondWith(fetch(event.request));
    // or simply don't call event.respondWith, which
    // will result in default browser behaviour
  });
  
  self.addEventListener('activate', function(event) {
    event.waitUntil(
      caches.keys().then(function(cacheNames) {
        return Promise.all(
          cacheNames.filter(function(cacheName) {
            // Return true if you want to remove this cache,
            // but remember that caches are shared across
            // the whole origin
          }).map(function(cacheName) {
            return caches.delete(cacheName);
          })
        );
      })
    );
  });
  </code></pre>