HTTP/2 APNs Push Notifications using Apache HTTP Server as Proxy
Josephine E. Justin, Kapil Powar April 20, 2020
MobileFirst_Foundation Push Notifications HTTP/2 ProxyMobileFirst Platform now supports the HTTP/2 based APNs Push Notifications.
Starting with iFix 8.0.0.0-MFPF-IF201812191602-CDUpdate-04, MobileFirst Platform supports HTTP/2 based notifications for Apple devices.
Note: Support for WAS ND is available from iFix 8.0.0.0-MFPF-IF202002111526. Support for HTTP/2 for Push Notifications would co-exist along with the legacy TCP Socket based notifications.
If you are an on-premise 8.0 customer or Mobile Foundation service customer, then read further to learn about using HTTP/2 based notifications
Benefits of HTTP/2 based Notifications
Moving to HTTP/2 based notifications provides various benefits, which includes the following:
- Universal certificate support - Single certificate for development and production.
- Instant Feedback - For any inactive tokens, feedback is provided by APNs immediately.
- Payload size - Notification payload size increases from 2 KB to 4 KB.
- Throughput increase - Compression helps in increasing the throughput for the notifications and reduces the need for simultaneous open connections.
Enabling HTTP/2 Notifications
HTTP/2 based notifications can be enabled using a JNDI property
<jndiEntry jndiName="imfpush/mfp.push.apns.http2.enabled" value= '"true"'/>
Apache HTTP Server Setup
Install the Proxy & related modules
Install the Apache HTTP Server to use as a proxy server. You can obtain Apache Webserver here.
Enable proxy modules & configure Forward Proxy
After the related modules are installed and enabled, to load and enable the proxy modules follow the steps below:
- Navigate to
proxy.load
file under/etc/apache2/mods-enabled
folder. - Edit the
proxy.load
to add the below lines:LoadModule proxy_connect_module /usr/lib/apache2/modules/mod_proxy_connect.so LoadModule proxy_ftp_module /usr/lib/apache2/modules/mod_proxy_ftp.so LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
- To configure the forward proxy, edit the
proxy.conf
file in the folder/etc/apache2/mods-enabled
. Edit the Proxy Server section to make sure the proxy section contains the below details:
# Proxy Server directives. Uncomment the following lines to enable the proxy server: <IfModule mod_proxy.c> #Enable the forward proxy server. Note:Do not use the ProxyRequests directive if #all you require is reverse proxy. ProxyRequests On <Proxy *> Order deny,allow #Deny from all Allow from all </Proxy> </IfModule>
- Start or restart the Apache HTTP Server using the command:
/etc/init.d/apache2 start
Note: HTTP servers from other vendors might have different configurations. Steps above are specific to Apache HTTP Server.
Enable Push Notifications to be routed via the Proxy
In the MobileFirst Platform server.xml
file, include the below JNDI properties to enable the proxy server routing for Push Notifications.
<jndiEntry jndiName="imfpush/mfp.push.apns.http2.enabled" value= '"true"'/>
<jndiEntry jndiName="imfpush/mfp.push.apns.proxy.enabled" value='"true"'/>
<jndiEntry jndiName="imfpush/mfp.push.apns.proxy.host" value='"<Host IP Address>"'/>
<jndiEntry jndiName="imfpush/mfp.push.apns.proxy.port" value='"<port>"'/>
<jndiEntry jndiName="imfpush/mfp.push.apns.proxy.user" value='"<username>"'/>
<jndiEntry jndiName="imfpush/mfp.push.apns.proxy.password" value='"<password>"'/>
Restart your MobileFirst Platform and send notifications.
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.