I’ve been using Ghost for a while, but I’m now in the process of moving back over to WordPress. Whilst I’ve been using Ghost(Pro), I’ve still maintained Cloudflare in front of that directly, to have more control over the caching and security configuration.
One of the main reasons I’ve been using Cloudflare is to cache everything at the Cloudflare edge to increase end user performance. The below rules set caching on everything other than the Ghost editor and the post preview functionality.
Note: The below was useful for my personal blog where there was very little change from day to day. If your site changes, especially on the same pages, you’ll need to take care using these rules.
Rule 1 – Secure the Ghost control panel
- URL: <domain.tld>/ghost/*
- Settings: Browser integrity check – ON
- Always Online – OFF
- Security Level – HIGH
- Smart Errors – OFF
- Browser Cache TTL – 30 mins
- Cache Level – BYPASS
- Disable Apps
- Disable Performance
Rule 2 – Disable caching on preview pages
- URL: <domain.tld>/p/*
- Always Online – OFF
- Smart Errors – OFF
- Browser Cache TTL – 30 mins
- Cache Level – BYPASS
- Disable Apps
- Disable Performance
Rule 3 – Enable caching on everything (Posts, Pages etc.)
- URL: <domain.tld>/*
- Browser Cache TTL – 5 days
- Cache Level – EVERYTHING
- Edge cache TTL – 1 day
Other Cloudflare configuration necessary to use with Ghost(Pro):
- Set your DNS to point to <subdomain>.ghost.io as supplied by Ghost(Pro)
- Enable the Cloudflare force SSL setting in Ghost(Pro)
- Enable Flexible SSL