When website owners need to optimize web experiences, they traditionally run code on the client, build backend solutions at their origin, or leverage a content delivery network (CDN) in the middle. For various use cases, having request and response transformation logic on the edge is ideal. It is even better when the website owner’s development teams are enabled to develop and test the full stack — including the CDN edge tier — on their own. Enter EdgeWorkers!
EdgeWorkers, alongside a suite of integrated developer tools, empowers you to:
- Configure: Add, move, or remove Property Manager behavior(s) within your delivery property to control the scope of the edge logic
- Confirm: Invoke tests from a local development environment looping through the CDN (edge and parent) to get a “full stack” evaluation of traffic transformations without impacting other developers or production traffic
It’s easy to upload and enable EdgeWorkers. If you are developing in EdgeWorkers, it's worth the time to set up a development environment as described in this series of posts. The tighter we can make these Configure>Code>Confirm iteration loops, the more productive you can be while ensuring the resulting business logic is solid and ready for production use.
Let’s walk through an example to illustrate how this intersection of serverless and content delivery improves performance and productivity.
For this example, we’ll use my passion (some might say an obsession) for golf. Many PGA professionals have shifted their traditional range teaching sessions to online content subscription websites. These subscription websites, like in many other industries, have different access tiers to help monetize the content.
Let’s imagine we have a very basic golf content subscription website, we.makegolf.fun, that has an AJAX call to “upgrade” an end user to a premium status, /getpremium. The content origin in this case will respond to the AJAX call with a JSON payload upgrading the user to premium status, along with a session cookie to keep the end user attached to that status level.
For instance, the JSON response could look like:
With a session cookie similar to:
Further, we know that in this case the context required to upgrade a user is available at the Akamai Edge. Thus, for end-user latency improvements as well as origin offload benefits, we want to move the "Go Premium" logic to the CDN layer versus going all the way back to origin.
In my next post, I’ll show how you can use EdgeWorkers to accomplish these goals.