1

As per the documentation at https://firebase.google.com/docs/cloud-messaging/js/client,

The FCM SDK is supported only in pages served over HTTPS. This is due to its use of service workers, which are available only on HTTPS sites. Need a provider? Firebase Hosting is an easy way to get free HTTPS hosting on your own domain.

During development, I need to test push notifications on our QA environment which is on private network.

For this, we created a self-signed certificate. however, chrome shows that the certificate is invalid.

How can I test push notifications for an internal server when I cannot get a certificate for it, since it is part of internal network of the organizatin?

  • Assuming your local QA environment for which the self-signed certificate has been issued is not your localhost then the previous answer won't work. I'm going to post a couple different answers, one of these may work for your use case. – Benjamin Sep 19 '18 at 8:27
1

To ensure that browsers won't reject communication with the QA server, you can take the self-signed certificate and install it on all hosts that need to access the local QA environment by following the instructions here

| improve this answer | |
1

To ensure that the solution for access via http://localhost works, you could set up a webserver (an instance of apache or nginx) on each host that needs to access the QA environment, set up to:

  • only accept connections from localhost (for security)
  • reverse proxy all connections to the QA environment - including any extra configuration to support particular features you require, e.g. websockets
| improve this answer | |
0

Don't use the self-signed certificate, just go to localhost using unencrypted HTTP. I never used FCM's JS SDK, but service workers indeed only work on HTTPS and on http://localhost. I suspect the same rule therefore applies to FCM.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.