Connect Akto with Cloudflare Container

(Traffic Connector Worker on CloudFlare sending traffic data to IngestData API in CloudFlare Container to enable discovery)

Cloudflare is a global network security platform that provides CDN, DDoS protection, and security services. Integrating Cloudflare with Akto will enable automatic discovery of all agentic components passing through your Cloudflare infrastructure, helping you maintain continuous visibility and protection of your edge-distributed components.

To connect Akto with Cloudflare, follow these steps -

Step 1: Deploy the Akto Mini-Runtime-Service as Cloudflare Container

Before configuring the Cloudflare Worker Traffic Connector, you need to deploy the Akto Mini-Runtime Service.

  1. The Akto-Mini-Runtime-Service is a container that runs on Cloudflare and is responsible for receiving traffic logs from the Cloudflare Worker.

  2. Configure image name of Akto Mini-Runtime Service.

Pre-requisites

  1. Make Cloudflare Account . Buy Workers Paid Plan to deploy containers through worker.

  2. Go to terminal of your system and configure to access cloud flare account by exporting cloud flare API token.

  3. You need to create Account API Token by visiting https://dash.cloudflare.com/<ID>/api-tokens

  4. Create token with below permissions : Containers:Edit, Queues:Edit, Workers R2 Storage:Edit, Workers Tail:Read, Workers KV Storage:Edit, Workers Scripts:Edit, Workers Scripts:Read, Account Settings:Read

Container deployment

  1. Create wrangler.jsonc file with these contents -

  1. Push Akto container to your registry (steps mentioned on Cloudflare docsarrow-up-right)

  1. Confirm the image on cloudflare registry. You will see similar below output :

Login Succeeded The push refers to repository [registry.cloudflare.com/<ID>/akto-mini-runtime]

This is the path of image to be configured in wrangler.jsonc - registry.cloudflare.com/<ID>/akto-mini-runtime:latest

Deploy Akto Traffic Collector (worker)

  1. Create a new Cloudflare project.

  2. In wrangler.jsonc file of the workder, add the docker image address

  1. Below changes in src/index.ts to connect the Akto Mini-Runtime Service with Cloudflare Worker and to call the API endpoint in the docker image.


/api/ingestData - Is the endpoint in our docker image to be called from container in cloud flare

  1. Now deploy container to cloud flare with command - wrangler deploy


Step 2: Set Up Your Cloudflare Worker Script

  1. Navigate to the Cloudflare Dashboardarrow-up-right and select your account.

  2. Go to Workers & Pages.

  3. Click Create and choose Worker.

  4. Click the Hello World button and deploy it.

  5. Click Edit code and replace the default script with the following example:


Step 3: Configure Worker Routing with Service Binding

To securely connect your client Worker (e.g., mcp worker) with the Akto Mini-Runtime-Service Container, use service binding. This allows your Worker to call the container Worker internally, without exposing it to the public internet.

1. Add Service Binding to Your Client Worker

  1. In the Cloudflare Dashboard, go to Workers & Pages.

  2. Under Overview, select your client Worker (e.g., mcp worker).

  3. Navigate to Settings > Bindings.

  4. Click Add binding and select Service binding.

  5. In the Variable name field, enter:

  6. In Service binding, select the container Worker you created in Step 1.

  7. In Entrypoint, select the container's Durable Object name.

  8. Click Add and then Deploy your Worker.

2. Restrict Container Worker to Internal Network

  1. Go to the container Worker in the Cloudflare Dashboard.

  2. Click Settings.

  3. Navigate to Domains & Routes.

  4. Disable both workers.dev and Preview URLs.

This ensures your container Worker is only accessible internally via service binding, improving security.

3. Add Service Binding via wrangler.toml or wrangler.json

Instead of using the Dashboard, you can also define the binding directly in your configuration file:

wrangler.toml:

wrangler.json:

This approach lets you manage service bindings as code, making deployments reproducible and easier to version control.


Now, your client Worker can securely communicate with the Akto Mini-Runtime-Service Container using the data_injection_worker binding, and your container Worker is not exposed


Step 4: Verify the Setup

  1. Confirm that traffic data (requests and responses) are captured on the Akto dashboard under the respective collection.

  2. Check logs of your Cloudflare container for any initialization messages from the extension.

  3. Navigate to Agent Collections > Hostname.

  4. You should start seeing the traffic from your Cloudflare Worker.


Get Support for your Akto setup

There are multiple ways to request support from Akto. We are 24X7 available on the following:

  1. In-app intercom support. Message us with your query on intercom in Akto dashboard and someone will reply.

  2. Join our discord channelarrow-up-right for community support.

  3. Contact [email protected] for email support.

  4. Contact us herearrow-up-right.

Last updated