0
votes

I have a project that works with FCM. On the localhost, every thing works fine and I get the token for FCM; but, in production, I get this error:

FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('https://myxdomain.com/firebase-cloud-messaging-push-scope') with script ('https://myxdomain/firebase-messaging-sw.js'): A bad HTTP response code (403) was received when fetching the script. (messaging/failed-service-worker-registration).

I'm deploying my app in an Apache server.

1

1 Answers

0
votes

As mentioned here, you need to add firebase-messaging-sw.js file in correct folder. It may be something like this: /var/www/...