In order to create great User Experience (UX), websites should always load fast. I mean immediately! It’s really tough to achieve instant results. AMP is one of the ways Google is trying to speed up the entire internet. But there’re simply so many steps we need to achieve in order to achieve speed. For every web design projects, loading speed is one of the top priorities for Krome.
We’ve always been crazy about pushing every single byte out of the way so that our sites can be loaded at lightning speed. Cloudflare is probably one of the coolest tools you can use to push up the speed limits.
One of the most annoying speed optimisations is Time to First Byte (TTFB). It’s really hard to reduce such stuffs. So, one of the ways is to use Cloudflare’s Worker.
For some of us, though it might sound good, it doesn’t make much sense until we see a practical example.
Time needed: 15 minutes.
Here are some simple steps to get it setup fast
- Install Cloudflare Page Cache WordPress Plugin
- Go to Cloudflare > WorkersClick ‘Launch Editor’
3. Click ‘Add Script’
4. Give a name
5. Click ‘Edit’
6. Delete all existing code
7. Add ‘Route’
Copy codes from https://raw.githubusercontent.com/cloudflare/worker-examples/master/examples/edge-cache-html/edge-cache-html.js
Paste Workers codes
Edit codes with your Cloudflare credentials
email: “”, // From https://dash.cloudflare.com/profile
key: “”, // Global API Key from https://dash.cloudflare.com/profile
zone: “” // “Zone ID” from the API section of the dashboard overview page https://dash.cloudflare.com/
8. Add ‘Route’
9. Create Route
Enter your website URL. I used an * (also known as wildcard) so that it applies to all my webpages.
Click on the dropdown and select your script
10. Click ‘Save’