I am trying to set up the service worker for a SPA I am making. Its hosted on AWS with S3.
Despite the file being in the correct place I still get the following errors
/service-worker.js:1 The script has an unsupported MIME type ('text/js'). https://djwdy6bk7t99o.cloudfront.net/service-worker.js
Failed to load resource: net::ERR_INSECURE_RESPONSE
The service worker specification requires that the response for the service worker JavaScript file used in the registration be served with a "JavaScript MIME type" (e.g., Content-Type: application/javascript) header.
That's what I'd expect the default to be for files served by S3 with a .js extension, but perhaps you've previously overridden the default settings? This answer has some details about changing that setting back.