[ServiceWorker] Service Worker Error (#858)

Hello,

Getting lots of errors all related to CORS. After 3 days of looking for the problem, I have found the problem to be this header:

<meta http-equiv="Accept-CH" content="DPR, Viewport-Width, Width" />

Not sure why but it does not work with service worker and produces many errors. For example I was using sw-toolbox and linking to some javascript files on cdnjs.com and some fonts via google fonts api, both started displaying messages of error 405 and cors problems.

e.g.

Failed to load resource: the server responded with a status of 405 (Not Allowed)

Fetch API cannot load https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.6/hammer.min.js. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.com' is therefore not allowed access. The response had HTTP status code 405. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

The FetchEvent for "https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.6/hammer.min.js" resulted in a network error response: the promise was rejected.

undefined:1 Uncaught (in promise) TypeError: Failed to fetch(…)

When I remove this meta header all problems disappear and when add it to the head section errors come back. 

Worth noting doing a quick search on the internet did find this which maybe related: https://github.com/igrigorik/http-client-hints/issues/68

Conclusion: This header and service worker do not work and give false errors.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/858

Received on Sunday, 27 March 2016 20:22:19 UTC