Connect Akto with Cloudflare Worker Proxy

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

To connect Akto with Cloudflare, follow these steps -

Important Note: This configuration works for proxying traffic to one worker only. The worker must have a service binding configured in the Cloudflare Worker Proxy with the variable name MCP. This binding is used to forward all incoming requests to your target worker.


Step 1: Deploy the Akto Data-Ingestion Service

Before configuring the Cloudflare Worker Traffic Connector, you need to deploy the Akto Data-Ingestion Service. Ensure that the service is running and accessible via a publicly available URL. Set up and configure Akto Traffic Processor. The steps are mentioned here. Ensure this instance is publicly accessible, as it will receive traffic logs from your Cloudflare Worker.


Step 2: Set Up Your Cloudflare Worker Script

  1. Navigate to the Cloudflare Dashboard 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 your Worker code that proxies traffic and mirrors it to Akto using service binding.

Important Notes while editing the Worker code

  • Replace <DATA_INGESTION_SERVICE> with the URL of the Akto Data-Ingestion Service you deployed in Step 1.

  • If you are using Cloudflare Service Binding to send traffic to your ingestion service hosted inside a Cloudflare container, use the following line instead of a public URL:


Step 3: Configure Service Binding (MCP)

After adding the worker code, you need to configure a service binding to connect this proxy worker to your target worker.

  1. In the Cloudflare Dashboard, navigate to your Worker (the proxy worker you just created).

  2. Go to Settings > Bindings.

  3. Click Add binding and select Service binding.

  4. Configure the binding with the following details:

    • Variable name: MCP (this must match the variable used in the worker code: env.MCP.fetch())

    • Service: Select the target worker you want to proxy traffic to

    • Environment: Choose the appropriate environment

  5. Click Save.

Note: The variable name MCP is used in the worker code on lines where env.MCP.fetch(request) is called. This service binding routes all incoming requests to your specified target worker while mirroring the traffic to Akto.


Step 4: Configure Worker Routing

If you'd like to route specific domains or paths through this Worker:

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

  2. Under Overview, select your Proxy Worker that you created in above steps.

  3. Navigate to Settings > Domains & Routes.

  4. Click Add Route.

  5. Select the appropriate zone (domain), and enter a route pattern such as:

This ensures all traffic matching the route is intercepted and mirrored to Akto.


Step 5: Verify the Setup

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

  2. Check logs of your Worker for any initialization or forwarding messages.

  3. Go back to the Akto Dashboard.

  4. Navigate to API Collections > Hostname.

  5. 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 inside the Akto dashboard and someone will reply.

  2. Join our discord channel for community support.

  3. Contact [email protected] for email support.

  4. Reach us here.

Last updated

Was this helpful?