OneSignal / OneSignal-WordPress-Plugin

OneSignal is a free push notification service for web and mobile apps. This plugin makes it easy to integrate your website with OneSignal Push Notifications. https://onesignal.com
Other
80 stars 42 forks source link

Error [Service Worker Installation] #231

Closed Caroladao closed 4 years ago

Caroladao commented 4 years ago

Description: Its showing this message: ServiceWorkerManager.js:392 [Service Worker Installation] Installing service worker failed SecurityError: Failed to register a ServiceWorker for scope ('mysite') with script ('mysite/app/plugins/onesignal-free-web-push-notifications/sdk_files/OneSignalSDKWorker.js.php?appId=...'): The script has an unsupported MIME type ('application/octet-stream').

Caroladao commented 4 years ago

Its a WordPress blog

jkasten2 commented 4 years ago

@Caroladao The root of the issue is the MIME type / content type should be application/javascript instead of application/octet-stream.

The OneSignal Wordpress Plugin already correctly sets Content-Type: application/javascript noted below. https://github.com/OneSignal/OneSignal-WordPress-Plugin/blob/master/sdk_files/OneSignalSDKWorker.js.php#L8

This points to some other plugin in your Wordpress modifying HTTP headers. Possibly some caching or CDN plugin. It could also be a nginx or apache configuration issue depending on how your site is hosted.

I moved this ticket to the Wordpress repo from general OneSignal-Website-SDK repo.

jkasten2 commented 4 years ago

Closing due to inactivity