A template for a Cloudflare worker which serves as a production CDN for a Helix project.
src/index.mjs is the content of the Workers script.
1. Setup Cloudflare production site
Follow the instructions here.
Update the following entries:
route(route for your site, e.g.
zone_id(your Cloudflare Zone ID)
account_id(your Cloudflare Account ID)
ORIGIN_HOSTNAME(the hostname of your Helix project, e.g.
3. Configure push invalidation (optional)
If you have succesfully configured push invalidation for your project your worker should send the following opt-in header:
All you have to do is to uncomment the respective line in the worker source code.
3. Publish your site
wrangler (if you haven’t done so already):
npm i @cloudflare/wrangler -g
Publish your site:
4. Test your site
Point your browser to your site (e.g.
For troubleshooting you can turn on logging in your terminal:
wrangler tail -f pretty