luckyankit
luckyankit

Reputation: 36

How to deploy a Cloudflare Worker for a wordpress website?

I tried a lot, but couldn't deploy this cloudflare worker about bypassing the logged-in cache - https://www.mmaton.com/2018/07/02/cloudflare-cache-anonymous-requests/

or

Cloudflare service worker code to "Bypass cache on cookie" not working

Whichever may work. I am not sure how do I deploy this for a WordPress website? Added the script the in editor inside Cloudflare login, saved and exited and the cloudflare worker status remains zero, shows no activity.

Couldn't find any tutorial for deploying same for WordPress anywhere.

Can anyone help here regarding this?

Upvotes: 1

Views: 1065

Answers (1)

Jake Riesterer
Jake Riesterer

Reputation: 116

Since you're not seeing any metrics for workers, it sounds like maybe the Worker script hasn't been enabled for any routes. In order for your worker to start processing requests, you'll have to configure route patterns that determine which requests should run the worker. To do so, navigate to the "Routes" tab next to the "Script" tab.

route tab

Then you'll need to click "Add Route". If you want to run the script for all requests to your site, you can use a route pattern like *example.com/* (replace example.com with your domain).

Upvotes: 1

Related Questions