Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Push Notifications stopped working after move to Amazon ec2 server

I've been testing my iPad app with ad-hoc distributions.

On our server (running Windows Server 2008) APNS alerts come through fine.

On the ec2 (also running Windows Server 2008) they never arrive.

The only difference between the two ad-hoc versions is the server they point to. Both have the same code-signing settings.

I followed the same procedure for importing certificates on both servers and as far I can tell the certificates are exactly the same on both servers.

I've also opened ports 5223, 2196, 2195 & 443 and allowed the address block:

enter image description here

I even tried turning off the Firewall but no joy and I still can't figure out why it works on one but not the other.

Anyone have any ideas?


I'm using MoonAPNS to handle sending the notifications via a C# / ASP.Net web service. Don't know if that makes any difference.

like image 406
Robert Avatar asked Mar 25 '23 06:03


2 Answers

Push notifications with EC2 work great. Used/implemented it in a couple of apps. Here's a couple of things to check

  1. Do you get an error when connecting to the APN servers? Try using $ telnet gateway.push.apple.com 2195. Does it work? In case it doesn't you might need to make changes to the security group/open the necessary ports

  2. If the server says the message was sent successfully, but you don't receive it in the app, make sure you check the mobileprovision and pem files you are using

Since you mention telnet works and you have checked the pem and mobileprovisions, a few other things to check

  1. Do you get any errors when MoonAPNS tries connecting to the APN servers?

  2. If no errors are returned, did you check if the device tokens were stored in your database and it was your test device's token?

  3. If messages are being sent out ok, did you ping feedback services? Do they return an error for a specific device token (i.e. your device)?

like image 178
lostInTransit Avatar answered Apr 12 '23 22:04


It turned out to be nothing specifically to do with the Amazon ec2 but rather something that not only should've been obvious but that I've also had an issue with before.

I'm using MoonAPNS and the problem was the first parameter in this line:

PushNotification push = new PushNotification(true, certificate, password);

The true parameter tells MoonAPNS to send the notification to Apple's sandbox server.

false tells it to send to the production server.

I had false on our own server and true on the Amazon ec2.

Both are now false and the notifications are at last coming through from the ec2.

Thanks to everyone for your efforts.

like image 43
Robert Avatar answered Apr 13 '23 00:04