Edge Functions for Small Sites: Personalisation Without Servers

Static sites are fast and cheap but identical for everyone. Edge functions add geo banners, smart redirects and A/B tests without a server in sight, using free tiers on Cloudflare, Netlify and Vercel.

Small scripts running where your visitors are

Static websites are fast, cheap and hard to hack, but they have one limitation: every visitor gets an identical page. Edge functions remove that limitation without reintroducing a server. They are small pieces of code that run inside your CDN's data centres, physically close to each visitor, and they intercept every request a moment before the cached page is served. That gives you a place to make decisions per visitor while the site itself stays static. If you have ever wanted the flexibility of a bespoke web app with the running costs of a brochure site, this is the closest the industry has come.

All the mainstream platforms offer a version: Cloudflare Workers, Netlify Edge Functions and Vercel Edge Middleware. There is nothing to rent, patch or scale, and the free tiers are generous; Cloudflare's free plan alone includes 100,000 Worker requests a day, far beyond what a typical small-business site uses. Because the code runs in the same place the page is served from, the cost in speed is measured in milliseconds.

Geo banners and localised pricing

Every request that reaches an edge function carries location data: Cloudflare attaches a two-letter country code to each request, and Netlify and Vercel expose a similar geo object. Your function reads it and adapts the response.

A worked example: a Midlands retailer ships across the UK and Ireland. The edge function checks the country code; visitors from Ireland see a banner reading 'EU delivery available, prices shown in euro at checkout', while UK visitors see 'Free UK delivery over £50'. Implementation is a few dozen lines: on Cloudflare, the HTMLRewriter API injects the banner into a placeholder element as the page streams through.

The caveat is caching. If the CDN caches one country's version of the page and serves it to everyone, your personalisation misfires. Either tell the platform to vary its cache by country, or keep the cached page identical for all and have the function pass the country in a header or cookie that a small script on the page reads.

Need a hand with this?

Our team delivers Cloud Web Apps for UK businesses — with a free initial consultation, transparent fixed quotes and no lock-in contracts. Tell us what you're working on →

Redirects and rewrites without touching server config

Redirects are where edge functions earn their keep on ordinary business sites. After a URL restructure, an edge function can map hundreds of old blog addresses to their new homes without a plugin or an .htaccess file. It can normalise trailing slashes so analytics stops double-counting pages. It can power short campaign links, so the address on your printed flyer is yourdomain.co.uk/summer rather than a long landing-page URL. And it can flip the whole site into a friendly maintenance page while you migrate something behind the scenes.

For large, simple lists, Cloudflare's Bulk Redirects feature handles thousands of mappings without writing code at all; reach for an actual function when you need pattern logic, such as redirecting anything under /old-shop/ to matching paths on /shop/.

A/B tests with a single cookie

Split testing on a static site sounds contradictory, but the edge makes it straightforward. On a visitor's first request, the function assigns them a variant at random and records it in a cookie. It then rewrites the request internally: variant A visitors receive the normal homepage, variant B visitors receive an alternative version you have published at a second path. Returning visitors keep their variant because the cookie persists, and your analytics tool records the variant as a custom dimension so you can compare enquiries or sales. Because the split happens before the page is served, there is no flicker of one version being swapped for another, which client-side testing tools struggle to avoid.

Two cautions. Under UK PECR rules, a split-testing cookie is generally not 'strictly necessary', so it belongs inside your consent tool like any other analytics cookie. And run few tests, briefly, with a clear question per test; a small site's traffic supports one decisive experiment at a time, not a dashboard full of them.

Five more jobs an edge function does well

Once one function exists, you find more uses for it. These five are common on small-business sites, and each is an afternoon's work rather than a project.

  • Security headers: inject a Content Security Policy, HSTS and frame protections on hosting that offers no header controls.
  • Light gating: protect a downloads area or client page with a shared password or signed link, no user database required.
  • Form defence: drop obviously spammy submissions before they ever reach your inbox or CRM.
  • API proxying: call a third-party API from the edge so the secret key never appears in your public JavaScript.
  • Scheduled content: show bank-holiday opening hours automatically by checking the date, then remove the notice just as automatically.

Key Takeaway

Edge functions let a static site behave dynamically: read the visitor's country to show geo banners or currency hints, run redirects without server config, and split traffic for A/B tests with a single cookie. Cloudflare Workers, Netlify Edge Functions and Vercel Edge Middleware all have free tiers that comfortably cover a small-business site. Keep the logic tiny, version-control it, and remember test cookies still need consent under UK rules.

Limits, costs and when to stop

Edge platforms impose strict CPU-time limits per request, and that is a feature: these are tools for tiny, fast decisions, not for running an application. Keep each function short, keep the code in version control, and test changes on preview deploys exactly as you would any other site change, because a buggy function sits in front of every page you serve. Watch the observability gap too: free tiers give you basic logs at best, so add a simple uptime check on a page your function touches.

Know when you have outgrown the pattern. Once you want user accounts, dashboards or anything with real state, you are building a web application and should build it as one. For everything up to that line, edge functions give a static site most of the personalisation small businesses actually need, at a monthly cost of roughly nothing. If you would like help adding this to your own site, our team builds exactly these setups.

Work With Us

Need Help With Your Digital Strategy?

Our team of experts is ready to help. Get a free consultation and tailored proposal.