How worker helps you to Improve Page Speed, even if I have WP APO Enabled?

I’m Using Pro Plan + Argo + APO…

Do I really need to create CF Worker?

When I search for Cloudflare Workers I can see two Things

1 - You write code.
We handle the rest.
Deploy serverless code instantly across the globe to give it exceptional performance, reliability, and scale.

2 - ( In the CF Dashboard )

Workers
Run JavaScript Service Workers in hundreds of Cloudflare data centers around the world. Modify a site’s HTTP requests and responses, make parallel requests, or generate responses from the edge.

Trigger Workers on your website by specifying which routes they execute on.


I’m Really Confused…

Both are same or different?


Anyway I created a Worker under my Pro Domains dashboard…

I got a URL something like this -

https://mywebname.username.workers.dev/

when I open this URL in Browser it shows…

Error 522 - Unable to communicate with Host -

Check your DNS Settings. A 523 error means that Cloudflare could not reach your host web server. The most common cause is that your DNS settings are incorrect. Please contact your hosting provider to confirm your origin IP and then make sure the correct IP is listed for your A record in your Cloudflare DNS Settings page.

When I searched about this - somewhere I got info to Whitelist Cloudflare IPs in my web server…

My Webserver is Litespeed - They have CF IPs whitelisted by default…

I Checked it Myself, CF IPs are there in the allowed list…

Still, it Returns 522 Error…

is there anybody using CF Workes…?

How does this Actually works in Real World…

Thanks…

I followed those steps exactly as described on this blog - https://www.krome.sg/blog/wordpress-plugin-and-cloudflare-worker-quick-guide/

CF Workers have a variety of use cases where one is you can code a CF Worker to equivalent Cloudflare CDN cache logic with custom cache settings with more finer grain control than available on CF Cache dashboard i.e. CF Free plan minimum cache TTL is 2hrs while you could code CF Worker to tell CF to cache for minimum time <2hrs i.e. 120 seconds if you want.

You need to code your CF Worker to do caching, just creating a CF Worker will do nothing unless you code it to do something.

See https://developers.cloudflare.com/workers/ and how to code CF Worker to do caching via either fetch() or via Cache API https://developers.cloudflare.com/workers/learning/how-the-cache-works

examples for using Cache API https://developers.cloudflare.com/workers/examples/cache-api

examples for using fetch https://developers.cloudflare.com/workers/examples/cache-using-fetch

You don’t need to but if you do caching via CF Worker you can have finer grain controls over your CF CDN cache parameters.

For example, with my own CF Woker caching I do per URL route cache TTL values which have conditional values based on time of day. So I can set cache TTL of 120 seconds at peak hour times and 3600 seconds at off peak times for specific URL path /path1 and bypass specific URL routes I don’t want cached and/or set a very short micro cache TTL for URL paths which cache frequently and only have micro caching to smooth out the load. Or set specific URL paths with never change to much longer cache TTL values like 30-90 days etc.

See my benchmarks of my own CF Worker caching vs Wordpress APO caching at

You can see Wordpress APO caching can almost get as close performance with one click toggle button as my own extensive optimisations which took months to test and do.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.