Self-Managed IO River Security in Akamai
IO River normally provisions and manages the Akamai configuration required to route traffic through its security services for you.
If you prefer (or need) to configure this yourself directly in Akamai Property Manager:
- This guide walks through creating the IOR-Security Akamai
Include, rule by rule. - The result matches the configuration that IO River would otherwise create automatically.
- You can then attach this
Includeto differentproperties.
What does the IOR-Security Include do?
The IOR-Security Include reroutes a copy of each request to IO River's security layer for inspection before it reaches your real origin.
The Include is created once per account/contract. Once created, it can be attached to any number of properties that need IO River's security services. Each Property just adds a reference to it and supplies its own service ID and origin values.
Setup Overview
This guide has two parts:
- Part A – create the IOR-Security
Includeitself (one-time setup). - Part B – attach the
Includeto aPropertythat needs IO River's security services (repeat for everyProperty).
Prerequisites
Before you start, make sure you have access to Akamai Control Center with permission to create Includes on the relevant contract/group.
Part A can be automated with a script instead of following the manual steps — see Automating Part A with a script.
Step 1 – Create the Include
- In Akamai Control Center, go to Content Delivery → Properties , and select the Includes tab.
- Click New Include.
- Select the product and click Create Include.
- Enter a Name:
IOR-Security. - Set Include Type to Common settings.
- Select the Group and Rule Format.
- Click Next and then Save.
The Include's Rule Format must match the rule format of every Property it's attached to. If a Property later upgrades its rule format, update this Include's rule format to match before re-activating the Property, otherwise activation will fail or behaviors may not validate correctly.
Step 2 – Add the variables
Within the Include version you just created, go to the Include Variables section and add the following variables:
IORIVER_CLEAREDIORIVER_ASNIORIVER_CITYIORIVER_COUNTRYIORIVER_REGIONIORIVER_CLIENT_IP
The initial value doesn't matter — each variable is overwritten at runtime by a setVariable behavior before it's used.
Akamai automatically namespaces Include-level user variables with a generated prefix unique to your account's Include (for example PMINC1419336_IORIVER_COUNTRY). Later steps reference these variables as {{user.<Include-ID>_IORIVER_...}} — always use Property Manager's Insert Variable picker to insert them rather than typing the reference by hand, since your actual prefix will differ from any example shown here.
Step 3 – Create the IORiver-Variables rule
- Under the
Include's default rule, click +Rules to add a new child rule. - Name it
IORiver-Variablesand click on Insert Rule. - Leave the criteria empty, so the rule always matches.
- Add behavior Set Variable:
- Variable: select
IORIVER_CLEARED - Create Value From: select
Extract - Get Data From: select
Request Header - Header Name:
X-IOR-Cleared - Operation: None
- Variable: select
- Add behavior Set Variable:
- Variable: select
IORIVER_CLIENT_IP - Create Value From: select
Extract - Get Data From: select
Request Header - Header Name:
X-IOR-Client-IP - Operation: None
- Variable: select
- Save the rule.
Step 4 – Create the IORiver-Security rule
-
Add another child rule under
default, namedIORiver-Security. -
Add a Variable criterion:
- Variable: select
IORIVER_CLEARED - Match Operator:
is not - Value:
{{parent.PMUSER_IORIVER_SERVICE_ID}}- Type this as a literal variable reference — this is a property-level variable supplied later in Part B, not something you define here
- Variable: select
-
Add the following behaviors:
a. Set Variable (ASN)
- Variable: select
IORIVER_ASN - Create Value From: select
Extract - Get Data From: select
EdgeScape Data - EdgeScape Field: select
AS Number - Operation: None
b. Set Variable (City)
- Variable: select
IORIVER_CITY - Create Value From: select
Extract - Get Data From: select
EdgeScape Data - EdgeScape Field: select
City - Operation: None
c. Set Variable (Country)
- Variable: select
IORIVER_COUNTRY - Create Value From: select
Extract - Get Data From: select
EdgeScape Data - EdgeScape Field: select
Country Code - Operation: None
d. Set Variable (Region)
- Variable: select
IORIVER_REGION - Create Value From: select
Extract - Get Data From: select
EdgeScape Data - EdgeScape Field: select
Region Code - Operation: None
e. Modify Outgoing Request Header (sidecar marker)
- Action:
Add - Select header name:
Other - Custom header name:
X-IOR-Security-Sidecar - Header value:
true
f. Modify Outgoing Request Header (preserve original host)
- Action:
Add - Select header name:
Other - Custom header name:
X-IOR-Original-Host - Header value:
{{builtin.AK_HOST}}- Type this as a literal variable reference
g. Modify Outgoing Request Header (override Host)
- Action:
Add - Select header name:
Other - Custom header name:
Host - Header value:
{{parent.PMUSER_IORIVER_SECURITY_ORIGIN}}- Type this as a literal variable reference — this is a property-level variable supplied later in Part B, not something you define here
h. Modify Outgoing Request Header
- Action:
Add - Select header name:
Other - Custom header name:
X-IOR-Client-IP - Header value:
{{builtin.AK_CLIENT_IP}}- Type this as a literal variable reference
i. Modify Outgoing Request Header
- Action:
Add - Select header name:
Other - Custom header name:
X-IOR-Geodata - Header value:
{{user.<Include-ID>_IORIVER_COUNTRY}},{{user.<Include-ID>_IORIVER_REGION}},{{user.<Include-ID>_IORIVER_CITY}},{{user.<Include-ID>_IORIVER_ASN}}- Use the Insert Variable picker to insert each of the four variables set in behaviors a–d — don't type this manually, since your
<Include-ID>prefix will differ from this example
- Use the Insert Variable picker to insert each of the four variables set in behaviors a–d — don't type this manually, since your
j. Origin Server — route the request to the security layer:
- Origin Type:
Your own origin - Origin Server Hostname:
{{parent.PMUSER_IORIVER_SECURITY_ORIGIN}}- Type this as a literal variable reference — this is a property-level variable supplied later in Part B, not something you define here
- Forward Host Header:
Origin Hostname - Cache Key Hostname:
Origin Hostname - Origin SSL Certificate Verification:
- Verification Settings:
Choose Your Own - Origin Certificate(s) to Honor:
Standard Certificate Authorities, with Akamai Permissive selected - Valid CN Values to Accept:
Origin HostnameandForward Host Header
- Verification Settings:
- Use True Client IP Header:
Yes- True Client IP Header:
True-Client-IP - Trust Client Setting:
No
- True Client IP Header:
- Rest of the settings should be default
- Variable: select
-
Save the rule.
Step 5 – Create the IORiver-Security-Cleared rule
-
Add another child rule under
default, namedIORiver-Security-Cleared. -
Add a Variable criterion:
- Variable: select
IORIVER_CLEARED - Match Operator:
is - Value:
{{parent.PMUSER_IORIVER_SERVICE_ID}}- Type this as a literal variable reference — this is a property-level variable supplied later in Part B, not something you define here
- Variable: select
-
Add the following behavior:
Modify Outgoing Request Header
- Action:
Add - Select header name:
Other - Custom header name:
True-Client-IP - Header value:
{{user.<Include-ID>_IORIVER_CLIENT_IP}}- Use the Insert Variable picker to select the
IORIVER_CLIENT_IPvariable set in Step 3 — don't type this manually, since your<Include-ID>prefix will differ from this example. Do not use{{builtin.AK_CLIENT_IP}}here — by this point the connecting IP is IO River's security layer, not the original client, so the real client IP must come from theX-IOR-Client-IPheader value that the security layer echoed back.
- Use the Insert Variable picker to select the
- Action:
Your rule tree under default should now contain exactly three child rules, IORiver-Variables, IORiver-Security and IORiver-Security-Cleared.
Step 6 – Validate and activate the Include
Activate the IOR-Security Include on Staging, then later on Production. It's fine to activate it now even though no Property references it yet — Part B attaches it to one or more properties.
The Include itself is now ready to be reused by any property. The rest of this guide is Part B, which you repeat for each property that needs IO River security enabled.
Automating Part A with a script
Steps 1–5 above (creating the Include and its rule tree) can be automated with the create_akamai_security_include.py script, instead of clicking through Property Manager by hand.
Prerequisites:
- Akamai API credentials configured in
~/.edgerc, with Property Manager (PAPI) read/write access. - Python 3 with the
requestsandedgegrid-pythonpackages installed (pip install requests edgegrid-python).
Usage:
python3 create_akamai_security_include.py --contract-id ctr_XXXX --group-id grp_XXXX
This creates the IOR-Security Include (type Common Settings), and writes the IORiver-Variables + IORiver-Security + IORiver-Security-Cleared rule tree described in Steps 2–5.
Options:
--rule-format— pin theIncludeto a specific rule format instead of the account's latest.--dry-run— print the generated rule tree JSON without calling the Akamai API.
The script only creates the Include and saves its rules — it doesn't activate it (Step 6) or attach it to a property (Part B); do those steps manually as described below.
Part B – Attach the Include to a property
Prerequisites
This step is easy to miss, but Step 1 below won't work without them. These are property-level values (not part of the Include itself), and they come from the IO River console, not Akamai:
IORIVER_SERVICE_ID— your IO River Service ID for this specific property. There are 2 ways to get it:- From the side panel when you select a service on the Services page.
- From the service URL:
https://manage.ioriver.io/<account-id>/services/<service-id>/...(e.g. forhttps://manage.ioriver.io/45cd502c-e526-42aa-aef5-962db7cde53d/services/2def1aa5-1a4b-4da2-ae9e-e5caeecf6189/..., the Service ID is2def1aa5-1a4b-4da2-ae9e-e5caeecf6189).
IORIVER_SECURITY_ORIGIN— the hostname of the IO River Security Origin. Found inside the service, under the CDN Providers tab: find theAkamairow, then copy the Security Origin Host value from its Provider Specific Settings.
Step 1 – Define the property variables
-
Open the
Propertythat should use this security integration. -
Go to Property Variables on the
Propertyand add two User Variables (if they don't already exist):IORIVER_SERVICE_ID– set the initial value to theProperty's IO River service ID from the Prerequisites above.IORIVER_SECURITY_ORIGIN– set the initial value to the security layer origin hostname from the Prerequisites above.
Akamai automatically namespaces user variables with a
PMUSER_prefix, so these resolve toPMUSER_IORIVER_SERVICE_IDandPMUSER_IORIVER_SECURITY_ORIGIN— matching the{{parent.*}}references used inside theInclude. They must be defined on theProperty(theInclude's parent), not inside theIncludeitself.
Step 2 – Reference the Include
- In the
Property's rule tree, add a child rule under theDefault RulecalledIORiver-Security-Rule - Under this rule, add a behavior Include, and select IOR-Security
- Save the
Propertyversion.
Make sure that the IORiver-Security-Rule rule is placed as the last rule in the Property rules.
Step 3 – Activate
- Activate the
Propertyversion on Staging. - Test against the staging hostname: confirm requests are routed to the security layer - you can review such requests in IO River's Security Analytics page.
- Once verified, activate the
Propertyon Production.