Trying to run a mock apns service on AWS EC2.
Connection works well with curl and simple go program using apns2 library.
However when using pushy the query gets stopped at the loadbalancer with a HTTP 1/1 400 Bad Request. So is not getting through to the mock apsn service.
It looks like pushy is trying to negotiate to use http2, but it is also resolving the CNAME of the hostname to make that request. The hostname of the EC2 instance does not have an SSL certificate, and AWS do not allow EC2 instances to have their own certificate. SSL is done via the load balancer. Which is why I guess it gets the Bad Request error.
Is there some way to get pushy.apns to go straight to h2, without the negotiation. The apple APNS service works simply by replacing the hostname in the curl and go examples I'm using.
The log output of a pushy request looks like
https 2018-10-12T08:19:30.301789Z app/pushproxy/7ba468ea0d0278b2 86.172.XX.230:61136 - -1 -1 -1 400 - 0 288 "- https://pushproxy-XXXXXXX.eu-west-2.elb.amazonaws.com:443- -" "-" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 - "-" "-" "arn:aws:acm:eu-west-2:914858662894:certificate/XXXXXX-d957-4e9d-bda6-00c2f42a6e3a" - 2018-10-12T08:19:30.286000Z "-" "-"
And a curl request looks like
h2 2018-10-12T08:13:43.142341Z app/pushproxy/7ba468ea0d0278b2 86.172.XX.230:60860 172.31.27.35:443 0.000 0.002 0.000 200 200 239 78 "POST https://pushproxy.mycompany.com:443/3/device/a9001c6cbf953a9b2820f4da9c7f8d37e84338460304a2ce0a04a32e85ca2532 HTTP/2.0" "curl/7.61.1" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 arn:aws:elasticloadbalancing:eu-west-2:914858662894:targetgroup/pushProxy/252675c1a61756ea "Root=1-5bc057b7-a61a4ca4d5880b40f00d17c0" "pushproxy.mycompany.com" "arn:aws:acm:eu-west-2:914858662894:certificate/XXXXXXX-a34f-415b-b687-8789cf21197f" 0 2018-10-12T08:13:43.140000Z "forward" "-"
curl command
curl -v -d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-id: 45454554646445454433433334332344" \
-H "apns-topic: com.2mee.Bridge2Mee" \
-H "apns-priority: 10" --http2 \
--cert pushcert.pem https://pushproxy.mycompany.com/3/device/a9001c6cbf953a9b2820f4da9c7f8d37e84338460304a2ce0a04a32e85ca2532