Sometimes we run blogs that are updated frequently and at predetermined intervals. It’s useful to warm up the cache after content has changed. I’ve used plugins but they don’t seem to work well.
I’ve confirmed that this mimics a visit from a browser and triggers caching.
- Right click and click on “Inspect”
- Go under the “Network” tab
- Select your site from the panel (usually at the top)
- Right click and go to “Copy”
- Select “Copy as cURL”
- Paste under your crontab
Here’s an example. Make sure you provide the full path the your curl binary:
05 * * * * /usr/bin/curl ‘https://example.com/’ -H ‘upgrade-insecure-requests: 1’ -H ‘user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKi t/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36’ -H ‘accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/ ;q=0.8,application/signed-exchange;v=b3′ -H ‘accept-encoding: gzip, deflate, br’ -H ‘accept-language: en-US,en;q=0.9’ –compressed