EdgeWorkers
With EdgeWorkers enabled, you can deploy JavaScript functions at the edge and create customized experiences for your website visitors.
Before you begin
- Add EdgeWorkers to your contract.
- Create an EdgeWorker ID to enable the EdgeWorkers behavior in your Akamai property configuration.
Why you need it
Here are some examples of how you can use the EdgeWorkers service:
- Redirect requests based on geography, device, and user-agent.
- Apply conditional logic to filter traffic and construct responses.
- Add or remove debug information from an HTTP message.
- Respond with custom error responses, even when the origin is down.
How it works
Like most serverless solutions, EdgeWorkers scripts are invoked at four different phases of an HTTP request. This provides an opportunity to improve performance by moving compute closer to your users. Using every edge server as a compute node accelerates your development and deployment times by applying solutions on a massive scale across the entire, globally distributed Akamai Intelligent Edge Platform.
Once you add EdgeWorkers to your configuration, developers can activate code outside of Control Center. Just activate custom scripts and efficiently implement site enhancements. You can write functions that access HTTP headers, cookies, and URLs in order to construct complex logic. With access to both content targeting data and device characteristics, you can build personalized solutions based on the location or the type of device making the request.
For more information about how to use the EdgeWorkers service to optimize your content delivery, go to the EdgeWorkers documentation.
Implementation
-
Navigate to your property in Akamai Control Center.
-
Click Edit.
-
Click Add rule.
-
Enter a name for your rule.
-
Choose a match criteria and scope.
Scope defines which requests should have EdgeWorkers functions applied. By limiting the scope you can avoid unnecessary serverless hits, which can improve performance and reduce cost.
- Search for EdgeWorkers in available behaviors.
-
Change the setting to On.
-
Click Insert Behavior.
-
Select an EdgeWorker identifier from the list.
If you haven't created an EdgeWorker identifier, click the link in the information dialog. The EdgeWorkers Management application will open in a new window.
Once you have created your EdgeWorker identifier, close the window and reload the Property Manager editor page. Now you can select the new EdgeWorker identifier from the list.
-
Save your property.
-
Click the Activate tab.
-
Click the Activate on Staging or Activate on Production button.
Once you've added the EdgeWorkers behavior in Property Manager follow the steps in the Hello World tutorial. This section also includes details about how to activate an EdgeWorker version on the staging or production network.
Updated about 3 years ago