Brian Rinaldi: Does the Serverless Edge Live Up to the Hype?
Your edge function – or middleware as some frameworks call it – will be called when the request comes in before it hits the origin server. It can modify that request, redirect it – so no need for slower server-side or client-side redirects or you can even handle access and authentication at this point.
The edge function can even fulfill the response itself. For example, if you have static assets like HTML, CSS, images and more cached on the edge, you can simply respond without hitting the origin server.
I wasn’t aware that serverless functions are generally regarded as not having lived up to their hype. I’m still pretty hyped on it. Nearly every project I do, major or minor, uses them in some way.
But remember edge functions are a distinct form of serverless function. They don’t have an origin, they execute geographically close to users, on computers connected to fat internet pipes specifically designed to run code quickly. Hype!
I wonder how a sentence like this will live up over time. Let’s call it Coyier’s Edge Law:
There is a 100% chance that an edge function will perform that fetch faster than your little hand computer on domestic internet will and give you the opportunity to return more “Real HTML.”