Skip to content

Instantly share code, notes, and snippets.

@diyfr
Created May 23, 2017 09:13
Show Gist options
  • Save diyfr/978e09d2f6127a9eef1ccdaff151780e to your computer and use it in GitHub Desktop.
Save diyfr/978e09d2f6127a9eef1ccdaff151780e to your computer and use it in GitHub Desktop.
Apache Proxy CORS configuration for fcm.googleapis.com
<VirtualHost *:80>
ServerName domain.com # configure your domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
#Don't miss to enable mod_header and mod_proxy
#replace fcm.googleapis.com in fcm endpoint registration
ProxyRequests Off
<Location /fcm/>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} !=OPTIONS
RewriteRule "/fcm/(.*)" "https://fcm.googleapis.com/fcm/$1" [P]
ProxyPassReverse "https://fcm.googleapis.com/fcm/"
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Max-Age 3600
Header set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token, ttl, crypto-key, TTL, Crypto-K$
</Location>
#Custom file logs
ErrorLog ${APACHE_LOG_DIR}/fcmproxy.error.log
CustomLog ${APACHE_LOG_DIR}/fcmproxy.access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment