Thinking about the year behind us (oh, I guess it’s a decade, too!), one of the more interesting technologies introduced has been Cloudflare Workers Sites. Cloudflare Workers, introduced
widely in 2018, is a re-think of how serverless works:
Service Workers are a feature implemented by modern browsers which allow you to load a script which intercepts web requests destined for your server before they hit the network, allowing you a chance to rewrite them, redirect them, or even respond directly. Service Workers were designed to run in browsers, but it turns out that the Service Worker API is a perfect fit for what we wanted to support on the edge.
HTMLRewriter always happens as close as possible to your end users, without happening on the device itself, and it eliminates the latency of traveling all the way to the origin