Сервисный работник Сообщение "TypeError: Vary header содержит *"

Я пытаюсь, чтобы на моем сайте asp.net mvc был активирован установщик веб-приложения, но я получаю следующую ошибку от работника службы:

ServiceWorker registration successful with scope:  https://badmintonbuddy.com/
sw.js:10 Attempting to install service worker and cache static assets
sw.js:1 Uncaught (in promise) TypeError: Vary header contains *
    at <anonymous>

Вот мой код JS работника службы:

var filesToCache = [
    './?utm_source=web_app_manifest'
];

var staticCacheName = 'bb-cache-v1';

self.addEventListener('install', function (event) {
    console.log('Attempting to install service worker and cache static assets');
    event.waitUntil(
      caches.open(staticCacheName)
      .then(function (cache) {
          return cache.addAll(filesToCache);
      })
    );
});

self.addEventListener('fetch', function (event) {
    event.respondWith(
      caches.match(event.request)
        .then(function (response) {
            // Cache hit - return response
            if (response) {
                console.log('Found ', event.request.url, ' in cache');
                return response;
            }
            return fetch(event.request);
        }
      )
    );
});

Пожалуйста, предложите, как я могу избавиться от этой ошибки и включить веб-сайт с установщиком веб-приложения.

0 ответов

Другие вопросы по тегам