Purge your MaxCDN Cache with GitHub Services
MaxCDN has recently added a GitHub Service allowing for automatic cache purging on code updates. Here’s a brief overview of how to setup this service.
Before You Start
Before getting started you’ll need the following information at hand.
- Your “Company Alias”, “Consumer Key” and “Consumer Secret”, obtained from your MaxCDN Account API Page.
- Your “Zone ID”, obtained from your MaxCDN Account Pull Zones Overview page.
- GitHub’s “hook” IP range, obtained by checking the “hook” key at GitHub’s “meta” API endpoint.
Adding the Hook
Setup of the MaxCDN GitHub Service is pretty straight forward. Added the MaxCDN service, by choosing “Settings > Webhooks & Services” in your GitHub project.
This will take you to a setup page, where you’ll need to enter the MaxCDN account information you’ve collected.
To allow GitHub to be able to purge your cache, you’ll need to whitelist their IP block. Because this is a block and not a single IP, you’ll want to use a wild card for the last set of numbers – e.g. “22.22.22.%” – allowing all IPs in the range access.
For more information on whitelisting IP with MaxCDN, see MaxCDN’s support page on How To Whitelsit Your Server IP To Use The API.
With that done, your cache’s will be purged whenever you push a change to your GitHub repo.