LogoLogo
  • Overview
    • Overview
    • Integration Modes
    • Minimum Required Dataset
    • Customer Service Desk
  • Netacea Plugin Information
    • Accessing Your Integration Settings
    • Akamai
      • Akamai Plugin Logic
      • Monitoring Configuration
      • Installation and Configuration
        • Proxy Property Configuration
        • EdgeWorker Installation
        • Property Configuration
          • Optional Integration Configuration
    • Cloudflare
      • Cloudflare Plugin Logic
      • Monitoring Configuration
      • Installation and Configuration
        • Installation via Wrangler (CLI)
        • Installation via Cloudflare UI
    • CloudFront
      • CloudFront Plugin Logic
      • Monitoring Configuration
      • Installation and Configuration
    • Fastly
      • Fastly Plugin Logic
      • Monitoring Configuration
      • Installation and Configuration
        • Advanced Configuration
        • Deployment via Terraform
    • Fastly Magento
      • Fastly/Magento Plugin Logic
      • Monitoring Configuration
      • Installation and Configuration
        • Advanced Configuration
    • F5
      • F5 Plugin Logic
      • Monitoring Configuration
      • Installation and Configuration
    • Vercel
      • Vercel Plugin Logic
      • Monitoring Configuration
      • Installation and Configuration
    • API Direct Integration
      • How to Build a Netacea Plugin
  • Netacea Data Sync
    • Data Sync
    • Recommendations
  • Captcha
    • reCAPTCHA User Journey
    • hCaptcha User Journey
    • Custom reCAPTCHA Page Guide
    • Custom hCaptcha Page Guide
Powered by GitBook

Copyright Netacea 2023

On this page
  • Prerequisites
  • Implementation Steps
  • Create local worker
  • Configure the worker
  • Configure Wrangler
  • Install/Update npm
  • Deploy the worker to Cloudflare
  • Confirm Deployment
  1. Netacea Plugin Information
  2. Cloudflare
  3. Installation and Configuration

Installation via Wrangler (CLI)

This section describes how configure and deploy the Netacea integration via the Wrangler.

PreviousInstallation and ConfigurationNextInstallation via Cloudflare UI

Last updated 8 months ago

Prerequisites

To successfully integrate using Netacea, please ensure you have:

  1. Installed , (version 16.13.0 or higher) and on you machine.

  2. An active Cloudflare account with access to the Cloudflare Dashboard.

  3. A “Paid” Cloudflare subscription, in order to avoid any issues with worker request-limits etc.

  4. Access to the Cloudflare Workers product.

Implementation Steps

The detailed GitHub instructions to pull the code, configure and deploy the Netacea Cloudflare plugin can be found .

Create local worker

Open Windows Command-Prompt/PowerShell and navigate to a directory where you can save the Netacea code.

Within that directory execute the following command

wrangler generate netacea-cloudflare-worker https://github.com/netacea/cloudflare-worker-template-typescript

This will use wrangler to create (generate) a new local worker bundle by pulling the latest Netacea GitHub code.

You can verify this by visiting the above directory and seeing the worker with the following format:

Configure the worker

Open the src directory and edit the NetaceaConfig.json file to match the below:

{
  "apiKey": "API-KEY-PROVIDED-BY-NETACEA",
  "secretKey": "SECRET-KEY-PROVIDED-BY-NETACEA",
  "mitigationType": "PREFERRED-MITIGATION-TYPE",
  "ingestType": "KINESIS",
  "kinesis": {
    "kinesisStreamName": "NAME-PROVIDED-BY-NETACEA",
    "kinesisAccessKey": "KEY-PROVIDED-BY-NETACEA",
    "kinesisSecretKey": "KEY-PROVIDED-BY-NETACEA"
  },
  "cookieEncryptionKey": "ENCRYPTION-KEY-PROVIDED-BY-NETACEA",
  "netaceaCookieName": "_cookieName",
  "netaceaCaptchaCookieName": "_captchaCookieName"
}

Replace the values with the details that Netacea has provided you and save the file.

The attribute mitigationType is used to determine the mode of the integration. This can be one of three values:

  • "INGEST" - This integration mode is monitoring only, meaning that no mitigation actions will be executed. This is recommended during POCs.

  • "MITIGATE" - This is the "normal" integration mode, meaning that the Netacea solution will monitor and actively mitigate requests.

  • "INJECT" - This mode is used in custom solutions in which the mitigation action by Netacea will only be a recommendation using HTTP headers added to the request.

The last three configuration variables are used to increase security by concealing Netacea's default cookie names and values from public view.

Configure Wrangler

Navigate to the worker's root directory and edit the wrangler.toml file:

name = "netacea-worker"
main = "./dist/worker.js"

account_id = "EXAMPLE_ACCOUNT_ID"
route = "EXAMPLE_ROUTE"

compatibility_date = "2023-05-04"

Replace the values with the appropriate details.

Once ready, save the file.

Install/Update npm

Within the worker root directory, execute the following two commands to ensure all the necessary node modules are installed/updated

npm i @netacea/cloudflare@latest
npm install

Deploy the worker to Cloudflare

Execute the following command:

npm run deploy

This might prompt you to login to Cloudflare via your browser and allow access to wrangler. If so, login and allow access.

You can use the above command to re-deploy the same worker in order to update it (e.g. changing the configuration properties). The last deployment will become active by default.

Confirm Deployment

Login to Cloudflare, open the dashboard and select "Workers Routes" from the menu. You should be able to see the newly deployed worker, associated with the route from the wrangler.toml file.

You can make changes to the worker, route, environment and more by clicking Edit, without the need to re-deploy the worker via wrangler.

Deployments of each worker can be seen by clicking on the environment (e.g. production) and selecting the Deployment's tab:

For each worker, you can see various metrics, the associated routes and have the option to roll-back to a previous deployment.

The can be found on your Cloudflare Dashboard.

The refers to the path that the worker should be applied to, e.g. "www.example.com/*" and can be edited after deployment.

Account ID
Route
Wrangler V2
Node.js
Git
here