An Akamai EdgeWorker enables you to run JavaScript code at the edge of the Akamai content delivery network (CDN). The code runs closer to end users, reducing latency and improving performance compared to traditional cloud or origin-based computing.
The procedures in this article create and configure a Cequence EdgeWorker that integrates with the Cequence Unified API Protection (UAP) platform. This integration is passive, which means that it cannot provide traffic mitigation such as blocking or rate-limiting traffic.
Because the Cequence EdgeWorker depends on the Cequence Bridge to mediate traffic to the Cequence UAP platform you must install the Bridge in addition to this integration.
Before you start
Before you add Cequence EdgeWorker to an Akamai property, confirm that your environment meets the following prerequisites.
- Access to the Akamai Control Center
- Appropriate permissions to manage EdgeWorkers and Properties
- A Cequence account and access to the Cequence UAP platform UI
- The compressed archive file that contains the Cequence EdgeWorker
Creating the client ID and client secret
Several Cequence components must authenticate to the Cequence UAP platform in order to transmit and receive data. Create authentication credentials in the Cequence UAP platform to enable this authentication.
- Log in to the UAP management portal UI.
The URL for the management portal is typically of the form https://ui.<your-tenant-name>.<domain>. Replace <your-tenant-name> with the name of your Cequence tenant organization. Replace <domain> with your domain name. - Select General Settings > User Management.
The User Management pane appears. - Click the Clients tab.
- Click Add New Client.
The new client dialog box appears. - Type the client name in the Client Name field.
This name is the client ID. Note the client ID for later use. - Enable the Traffic Ingestion toggle.
- (Optional) To change the token lifespan from the default of 1800 seconds, type a whole number of seconds in Token Lifespan.
- Click Save.
A dialog box with the client secret appears. - Click the blue Copy icon to copy the secret to the clipboard, then click Close.
The client is now set up. Note the client name for future use.
The client list appears. - Note the value of the client secret for later use. This value will not be shown again later on the UI for security reasons.
Creating the Cequence EdgeWorker in Akamai
For details on managing Akamai EdgeWorkers, consult Akamai's documentation.
- Log in to the Akamai Control Center.
- Click EdgeWorkers > Create EdgeWorker.
- In Name, type Cequence EdgeWorker 1.
- In Description, type Cequence API Security and Bot Protection EdgeWorker.
- Choose the defaults for Group, Contract ID, and Resource tier.
- Click Create.
- Click the ID associated with the newly created EdgeWorker.
- In the EdgeWorker ID details page, select the Versions tab.
- Click Create Version.
A file browser appears. - From the file browser, select the compressed archive file that contains the Cequence EdgeWorker.
- Click Create Version.
- Select the version to activate
- Click Activate version and choose the network.
The network options are Staging or Production. - Confirm the activation.
Attaching the Cequence EdgeWorker to a Property
After creating and activating the Cequence EdgeWorker, attach the EdgeWorker to an EdgeWorker Property.
An EdgeWorker Property configuration is a connection point between your deployed EdgeWorker code and the actual web traffic flowing through the Akamai CDN, enabling precise control over the execution of your edge computing logic.
- Log in to the Akamai Control Center.
- In the Property Manager, select a property.
- Click Active Staging Version > New Version or Active Production Version > New Version, as appropriate.
- In Property Variables, click + Variables.
- In Name, type CEQUENCE_CLIENT_ID.
- Select String from the Type drop-down.
- In Value, type the Cequence Client ID generated earlier in this article.
- In Property Variables, click + Variables.
- In Name, type CEQUENCE_CLIENT_SECRET.
- Select String from the Type drop-down.
- In Value, type the Cequence Client Secret generated earlier in this article.
- In Property Variables, click + Variables.
- In Name, type CEQUENCE_HOSTNAME.
- Select String from the Type drop-down.
- In Value, type the same value displayed in Property Hostname.
- In Property Variables, click + Variables.
- In Name, type CEQUENCE_AUTH_TOKEN_URI.
- Select String from the Type drop-down.
- In Value, type an alternative token URI for authentication.
- Confirm that sensitive variables, such as CEQUENCE_CLIENT_SECRET, are marked Hidden.
- Click Save to save the variables.
Adding a Cequence EdgeWorker Rule
- Log in to the Akamai Control Center.
- In Property Configuration Settings, click + Rules.
- Select Blank Rule Template.
- In Name, type Cequence EdgeWorker and click Insert Rule.
- In the Behaviors section, add a new Standard property behavior.
- Search for and select EdgeWorkers, then click Insert Behavior.
- In EdgeWorker Identifier, select the ID or name of the EdgeWorker assigned, such as Cequence EdgeWorker 1.
- Click + Match, If: Path matches one of
/*
- In Property Configuration Settings, click + Rules.
- Select Blank Rule Template.
- Name the new rule Cequence Edge Origin Rule then click Insert Rule.
- In the Behaviors section of the rule, add a new Standard property behavior.
- Click Add Behavior.
- Search for and select Origin Server.
- Configure the following behavior settings.
- Click + Match, If: Path matches one of:
/api-transactions
- Origin Type: Your Origin
- Origin Server Hostname: The hostname for Cequence Edge, for example, edge.yourcompany.1.cequence.cloud
- Forward Host Header: Origin Hostname
- Cache Key Hostname: Origin Hostname
- Click + Match, If: Path matches one of:
- In Property Configuration Settings, click + Rules.
- Select the Blank Rule Template, call the new rule Cequence Auth Origin Rule, and click Insert Rule.
- In the Behaviors section, add a new Standard property behavior.
- Click Add Behavior.
- Search for and select Origin Server.
- Configure the following elements:
- Click + Match, If: Path matches one of:
/auth/realms/cequence/protocol/openid-connect/token
- Origin Type: Your Origin
- Origin Server Hostname: The hostname for Cequence Auth (e.g., auth.yourcompany.1.cequence.cloud)
- Forward Host Header: Origin Hostname
- Cache Key Hostname: Origin Hostname
- Click + Match, If: Path matches one of:
- Click Add Behavior.
- Search for and select Cache POST Responses.
- Configure the following elements:
- Status: On
- POST Body: Include the MD5 hash in cache key
- Click Add Behavior.
- Search for and select Caching.
- Configure the following elements:
- Caching option: Cache
- Force revalidation of stale objects: Always revalidate with origin
- Maxage: 1700 seconds (this assumes the token lifespan set for CEQUENCE_CLIENT_ID is greater that 1700 seconds; default is 1800 seconds)
Saving and Activating Property
- Save your property changes.
- Go through the validation process.
- Activate the property on Staging for testing.
- Once tested and verified with Cequence, activate on Production.
Troubleshooting
If you encounter issues:
- Check the EdgeWorker logs in the Akamai Control Center
- Verify that the EdgeWorker ID in the property matches your Cequence EdgeWorker
- Ensure all required Cequence variables are correctly defined and not exposed
- Confirm that your Cequence account is active and properly configured
- Verify that the CEQUENCE_CLIENT_ID and CEQUENCE_CLIENT_SECRET match the credentials provided by Cequence