title: Problem integrating Service Workers into Symfony project
body: <p>I'm trying to integrate Service workers in my Symfony project in order to cache some files and make my page into a PWA and make it work offline.</p>
  
  <p>Sadly, I stumbled into a problem and I've been trying to fix it for a week now without any success.</p>
  
  <p>My problem here is inside my Service Worker js file. I was actually able to call the service but could not find the pages inside it, which generated an error since it could not find the pages linked inside the js file.</p>
  
  <p>Here's my code sw.js:</p>
  
  <pre><code>var cacheName = 'hello-pwa';
  var filesToCache = [
  '../manifest.json',
  '../favicon.ico',
  '../../../templates/User/User.html.twig'
  ];
  
  /* Start the service worker and cache all of the app's content */
  self.addEventListener('install', function(e) {
    e.waitUntil(
      caches.open(cacheName).then(function(cache) {
        return cache.addAll(filesToCache);
      })
    );
  });
  
  /* Serve cached content when offline */
  self.addEventListener('fetch', function(e) {
    e.respondWith(
      caches.match(e.request).then(function(response) {
        return response || fetch(e.request);
      })
    );
  });
  </code></pre>
  
  <p>The manifest.json and favicon cache just fine but when I add '../../../templates/User/User.html.twig' I get the following error (Uncaught (in promise) TypeError: Request failed).</p>
  
  <p>Please help me guys I've been trying to solve this for a whole week.</p>
  
  <p>Here's an image of my folder:<a href="https://imgur.com/a/cb8YYOe" rel="nofollow noreferrer">https://imgur.com/a/cb8YYOe</a></p>