EdgeWorkers

With EdgeWorkers enabled, you can deploy JavaScript functions at the edge and create customized experiences for your website visitors.

Before you begin

  1. Add EdgeWorkers to your contract.
  2. 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

  1. Navigate to your property in ​​Akamai Control Center​.

  2. Click Edit.

  3. Click Add rule.

  1. Enter a name for your rule.

  2. 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.

  1. Search for EdgeWorkers in available behaviors.

  1. Change the setting to On.

  2. Click Insert Behavior.

  3. 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.

  1. Save your property.

  2. Click the Activate tab.

  3. 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.


Did this page help you?