Service worker: The script has an unsupported MIME type ('text/html')

Is there anything particular which needs to be done to configure the IC to serve correctly a service worker script?

I get following error:

The script has an unsupported MIME type (‘text/html’).
service worker error DOMException: Failed to register a ServiceWorker for scope (‘’) with script (‘’): The script has an unsupported MIME type (‘text/html’)

Link to app

The issue is that is already registering a serviceworker. Try accessing the site through

Thanks, it solves the issue.

1 Like

Btw., if I may, what’s raw or what’s the difference, beside the sw, between with and without raw?

That’s it, really. Assets delivered over are mediated by a service worker that checks that they are all certified assets before loading them.

The use case is that a malicious node responding to a query call for an asset could send a falsified response, messing with your application. A certified asset comes with a certificate that is is essentially a merkel tree, signed using our chain key consensus mechanism. That way, you can get a fast query from a single node and trust the signature, even if you don’t trust the node.

That said, the UX of the service worker is definitely slower and limiting, and the operations team is working on an alternate way to achieve the same level of trust through other means


Thank you for the explanation :pray: All clear.

Glad to hear there aren’t other differences. As we don’t need that trust level with our app for the time begin, I’ll then continue with raw. The boot time performance boost is quite impressive.

I wonder if the service worker can make use of local storage and load certified data from cache if their hashes didn’t change. That will significantly speed up HTML5 apps when “Add to Homescreen” on mobile phones.