Reference Server for pushing Safari Notifications via Apple Push Notification Service For use with Safari Push Plugin for Wordpress (
Switch branches/tags
Nothing to show
Pull request Compare This branch is 60 commits ahead, 4 commits behind connorlacombe:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Safari Push Notification Server

Reference Server for pushing Safari Notifications via Apple Push Notification Service For use with Safari Push Plugin for Wordpress (


SSL-based server (NOT A self-signed one), PHP, Apple developer account


  • Register your site with Apple (refer to this document )
  • Download this file
  • Upload all files to the root (eg., and be sure to include the entrust_2048_ca.cer file, your Certificate.p12 and Website_Push_ID_Production_Certificate.pem from Apple.
  • Create a mysql database as per push.sql
  • Edit config-sample.php and save it as config.php
  • Replace the images in pushPackage.raw/icon.iconset/

Common issues

  • You must be using an SSL (HTTPS) server, signed by a recognised authority. If you're looking for a free service, we've been using StartCom which works well.
  • Requests must be mapped to /v1/request (for example must be a valid URL) - the included .htaccess file should do this for you if you upload the files to the server root
  • You will probably need to specify domains with and without the "www." part in the config file (e.g. define('ALLOWED_DOMAINS', '"", ""'); )

Generating the .pem file

During the push registration process you should receive two files, the .p12 and website_aps_production.cer file. Apple calls this last one a "Website Push ID Production Certificate". The p12 file is used to create a push package (to request the user to accept notifications from your site). You should be able to get another copy of this p12 file from your keychain, see this link The cer file is used to actually send out push notifications by the server (to establish communication with APNS), but it seems it must be converted into a .pem file first, which the official documentation doesn't mention.

To perform this conversion, use the command openssl x509 -in website_aps_production.cer -inform DER -out apns-cert.pem -outform PEM in Terminal. See this Stackoverflow article for more information, and also this link for an alternate method.

You can then test that you can connect to APNS using this file with the command openssl s_client -connect -CAfile apns-cert.pem

Also bear in mind that these certificates are typically only valid for a year, so you'll have to run through the process annually.

Sending a test push

If you've configured everything correctly, and are at the point where you are successfully able to subscribe to notifications through Safari, you can manually send a test notification from Terminal with:

curl --data-urlencode "title=Test" --data-urlencode "body=This is a test" --data-urlencode "button=View" --data-urlencode "urlargs=/" --data-urlencode "auth=your authentication code"

or if you know the specific device token to send the push to, replace with

You can also do this in a browser, like so: (for a specific device, that's

Where to get more information


Based on Safari-Push-Notifications by Connor LaCombe (