What is the Cloudflare Workers feature?
The Cloudflare Workers tool allows the execution of JavaScript code directly at the edge of Cloudflare.
This means that when using this feature you can execute JavaScript code using the Cloudflare infrastructure.
This feature opens up a range of possibilities and can provide the user with a more fluid and safe browsing experience.
Therefore, we can configure this feature to achieve a better performance when loading pages.
If you are trying to optimize your site and are having trouble reducing TTFB this tip is for you!
How to Increase WordPress Speed Using Cloudflare's Workers Feature
First of all, we must access the Cloudflare account and navigate on the Panel to the Workers option.
As we can see Cloudflare offers 100,000 requests per day for free, this should be sufficient for small sites and blogs.
After that, we must click on the Launch Editor option so that we can start configuring the script responsible for the optimization.
Then click on Add Script, define a name for your script, it can be any name.
After configuring a name for your script, click on the Edit option so that we can change the script.
On the editing screen, delete any script that was created automatically.
Once this is done, you must insert the script found in the link below, copy and paste the script into Cloudflare Workers.
Download link on Github:
The script should look like the image shown below, now we just have to add some information to it.
Now you must fill in the data requested on lines 8, 9 and 10, just search for the information on the links below:
email: “”, // You can find this in Account Setup
key: “”, // Global API also in Account Setup
zone: “”, // And Zone ID here Account Setup
After setting up the data above, you need to add the Route, click on Routes and go to the Add Route option.
In the first field you must enter the URL of your website, in the second option select the script you have configured.
Once this is done, click Save, then click on the Script option and press the Deploy button.
All set, now your script is already configured and you can already see the difference in the performance of your WordPress site.