JS code at the network edge. Oh, you're still here and not running, screaming? Read on
Cloudflare Workers offered to customize content
The outfit puts copies of customers' websites and content at various locations around the globe to enable speedy delivery and provides an efficient path to customer servers. It also does other things, like protect against malicious web traffic.
Making its edge points programmable would be appealing to customers, because it would allow them to run code designed to address local issues that aren't necessarily relevant elsewhere.
One way to do this, explained Cloudflare tech lead Kenton Varda, would be to run virtual machines or containers for every customer endpoint, but that would be expensive and complicated.
"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," he explained in a blog post.
These Service Workers intercept incoming HTTP requests sent to a customer's domain and can return an HTTP response or make outbound HTTP requests to any other public internet address.
They allow site publishers to do things like put HTML templates at the edge of Cloudflare's CDN and only fetch dynamic content from company servers, or craft custom security rules, or implement customized load balancing and failover logic.
The Cloudflare Workers Playground, which sounds like socialist vacation spot, turns out to be a place where the curious can try out some code. Interested parties may wish to petition for beta access. ®