5 Cloudflare Worker Use Cases for Webflow
Real examples of using Workers with Webflow.
There’s a ceiling to what you can do in Webflow.
Cloudflare Workers helps you go beyond that. It sits between the visitor and your site and runs before the page loads.
That means you can control things that Webflow doesn’t support natively. Like modifying requests, updating HTML, fetching data from other sources, etc.
In this post, I’ll share a few common ways I use Workers with Webflow sites.
How a Worker actually works
Before jumping in, let’s quickly look at how a Worker sits in front of your Webflow site.
Normally, when someone opens your site, the request goes straight to Webflow. Webflow returns the page, and the browser renders it.
A Worker becomes the middle layer.
When your domain is behind Cloudflare, every request goes through their network before it reaches Webflow. A Worker is a small piece of code that runs there.
It can read the request as it comes in, change it if needed, decide where it should go, and also see the response before it gets sent back.
The visitor loads the site directly from Webflow.
1. Serving multiple Webflow sites under the same domain (Reverse Proxy)
This is one of the most common Worker setups for Webflow sites.
One real-world example is migrating a large site to a new brand. The client has a large existing site, and rebuilding everything at once would take months. So instead of waiting for the full rebuild, you build page by page.
The homepage, pricing, product pages, and about page get rebuilt in a new Webflow project with the updated brand. The blog, customer stories, and legal pages stay on the old project for now.
The issue is that Webflow cannot serve two different sites under the same domain.
A Worker fixes this by sitting in front of the site and deciding which Webflow project should load for each page request.
- /
- /product
- /pricing
- /about
- /blog
- /customers
- /legal
2. Rewriting HTML before it reaches the visitor
Once the site is behind a Worker, you can modify the HTML on its way to the visitor.
Not after the page loads with JavaScript. The HTML itself is modified on the way. The page shows up already finished.
No flicker, no flash of unstyled content, works even with JavaScript disabled.
Here are a few things you can do with it:
- Render every CMS item, not just the first 100: Webflow has a hard limit on collection lists. A Worker can fetch the rest and stitch them into the HTML before it is sent.
- Swap text or content for personalization: Read a cookie from the request, then rewrite the
<h1>based on its value. The visitor never sees the placeholder text. - Strip things you don’t want: Remove Webflow’s jQuery if you’ve replaced it with your own code.
The tool behind this is Cloudflare’s HTMLRewriter.
return new HTMLRewriter()
.on("h1", { element: (el) => el.setInnerContent("New heading") })
.transform(await fetch(origin));
It goes through the HTML response and lets you target elements using selectors, similar to document.querySelector, but on the server.
Tip: selectors can break when Webflow changes the structure on publish. Use stable selectors like custom attributes, instead of class names or auto-generated IDs.
3. Redirecting visitors based on their country
This is something we set up on almost every Webflow project that uses Locales.
Webflow’s native localization does not automatically redirect visitors based on their geographic location.
So if you want someone from Germany to land on /de by default, that logic needs to be implemented separately.
Even on Advanced and Enterprise plans, Webflow’s automatic locale routing relies on the visitor’s browser language, not their actual location.
For simple setups, you don’t need a Worker at all. A Cloudflare redirect rule can handle basic cases like “country X → path Y” directly from the dashboard.
A Worker becomes useful when the logic gets more complex.
For example, when you want to respect a manual override so a visitor who chose English stays on English. Or when different parts of the site follow different rules.
Try switching the visitor’s country to see the locale change:
Welcome
This page is shown in your language.
An example redirect logic:
const country = request.cf.country;
if (country === "DE" && !url.pathname.startsWith("/de")) {
return Response.redirect(origin + "/de" + url.pathname, 302);
}
4. Hiding API keys while fetching external data
Let’s say you want to show open jobs from an HR platform on a careers page.
The unsafe way is to call that HR API directly from the browser. But that usually means exposing your API key in the frontend, which anyone can see in DevTools and copy.
The safer setup is to put a Worker in between.
Your Webflow page calls your own endpoint, something like /api/jobs. That request goes to the Worker. The Worker stores the HR platform API key securely, fetches the jobs from the real API, and sends only the job data back to the page.
Here’s the basic flow behind it:
The browser calls the Worker, not the HR API
When a visitor opens your careers page, the browser needs the list of jobs.
Instead of calling the HR API directly, it sends the request to your Worker at a URL like /api/jobs.
The Worker calls the HR API
The Worker stores the HR API key as an environment secret. When the request comes in, it attaches the key and calls the real HR API itself. This second request happens on the server, so the key is never visible in the browser.
The Worker returns the response
The HR API responds with the list of jobs. The Worker sends those jobs back to the browser as the response. From the browser's side, it only ever talked to the Worker. The HR API stays invisible.
5. Syncing the Webflow CMS on a schedule
A scheduled Worker runs on its own every hour, every day, or every few minutes. It can pull content from Airtable, Notion, Google Sheets, a database, or wherever the content team actually works, compare that data with what is already in Webflow CMS, and then push the changes through the Webflow API.
Here’s a simplified view of an automated CMS sync:
- Why we built this published
- The case for design draft
- Hiring a designer published
- Designing for clarity published
This is useful when the people managing content should not have to open Webflow Designer just to update the site. They keep working on the tool they already know, and the site stays in sync automatically.
A few things to watch for:
- The Webflow API caps at 60 requests per minute. On bigger syncs, you’ll need to batch (bulk endpoints update many items in one call) and slow down between batches.
- Make the sync idempotent. Store the Airtable or Notion record ID as a custom field on each Webflow item. On every run, check for an existing item using that ID before deciding to create or update. This prevents duplicates if a sync retries after a partial failure.
Most Webflow sites don’t need any of this. Native tooling covers you for a long time, and you should use it until it doesn’t.
But when you hit the ceiling, a Worker is usually the simplest way through.
These are just a few ways I’ve used Workers on different Webflow projects. There’s a lot more you can do with them.
You can serve images and assets from Cloudflare instead of Webflow, build small backend APIs for forms or apps, cache API requests, handle logins, or connect Webflow with other tools and systems.
Once you add a Worker in front of a Webflow site, you get a lot more control and flexibility.