title: What causes a Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode error?
body: <p>After upgrading to Chrome 64, I realized that this error appears when I load my page on a new tab.</p>
  
  <p><a href="https://i.stack.imgur.com/zr59z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zr59z.png" alt="enter image description here"></a></p>
  
  <p>I can't identify where it is on the service worker. Here is my code to run the fetch:</p>
  
  <pre><code>self.addEventListener('fetch', function(event) {
     if (event.request.url.startsWith(self.location.origin)) {
         event.respondWith(
             caches.match(event.request).then(function(response) {
                return response || fetch(event.request).then(function(fetch_resp){
                    return fetch_resp;
                });
             })
         );
     }
  });
  </code></pre>
  
  <p>Could anyone here, who has more knowledge about service worker, help me to solve this error?</p>