push-notificationweb-pushchrome-gcmvapid

Web Push vapid key generation logic


I have multiple https domains for sending web push notifications. But i will send web push notification from one server. I know why it is use and i read some documents about it. But i didn't see anything about this approach. I generated vapid key from my server just once. I tried to send push notification with these keys and i got notification successfully. But i have 2 question for you.

  1. Should i generate different VAPID key for each domain ?
  2. Can i generate just one VAPID key and use all domains ?

Solution

    1. For security and isolation, you should create a different VAPID key for each separate project. If the same project uses multiple domains or subdomains you can use the same VAPID key and there isn't any problem.
    2. Yes, you can. However if you deal with completely different websites this is not recommended: you can improve security and data portability by using different VAPID keys.