This plugin will automatically flush Peakhour's global CDN when editing posts,pages,media through the wordpress admin.
It also enables manual flushing based on URL patterns from within the wordpress admin.
From within wordpress
- Log in to your wordpress admin
- Click on Plugins in the left menu
- Click on the 'Add New' button at the top of the page
- Search for 'Peakhour', we should be the first result!
- Click on 'Install Now'
- Activate from your installed plugin page
- Click on Peakhour.io in the left menu
Then in a new tab/browser window
- Log in to your Peakhour account at peakhour.io
- Click on 'API Keys' in the left menu
- Enter the name of your domain in the API key name and click 'Create'
- Copy the generated API key and paste it into the 'Peakhour API key'
- Go back to your wordpress window and paste the API key into the 'Peakhour API key' field
- enter your domain name (do not enter www or http:// etc)
- Click on 'Save Changes' at the bottom of the page
- Click on the 'Test connection' button that will now appear in the 'Connection Settings' section
Back in the Peakhour admin, configure cache settings
- Click on 'Domains' in the left menu
- Now click on the 'Manage' button on the right of your domain
- In the left navigation find CDN -> Settings and click
- Under the Skip CDN on cookie setting enter 'wordpress_logged_in*', this will cause the cache to be skipped for logged in users.
- Tick the 'Ignore requests that invalidate'
- Towards the bottom of the page find the 'Tag Header Name' setting and enter 'X-Cache-Tags'
- Next look at the 'Tag Separator' setting and select 'comma'
- Save the settings.
Configure Caching rules
If wordpress is not sending cache control headers, this plugin won't, then caching rules need to be set up. The following are for a standard
wordpress information site. If you have additional functionality, eg woocommerce, then additional configuration will be required.
- Continuing on from the configure cache settings section and find EDGE -> Rules in the left menu
- As a safeguard add in three no caching rules.
2.1 Enter 'php' as the rule name, 'ends_with(http.request.uri.path, ".php")' as the filter, add the setting 'CDN Status' and select disabled. Save
2.2 Enter 'wp-admin' as the rule name, 'http.request.uri.path eq "/wp-admin/"' as the filter, add the setting 'CDN Status' and select disabled. Save
- Add in the general caching rule. Enter 'general page caching' as the rule name, 'ends_with(http.request.uri.path, "/")' as the filter, then add:
CDN Status = enabled
Strip Outgoing Cookies = enabled
Strip Cookies from response = enabled
Ignore Cache Headers = enabled
Require Cache-Control for caching = disabled
Browser TTL = don't cache
CDN TTL = 30 days
Save
You can of course make the CDN TTL longer or shorter as required.