Skip to main content
Version: 4.6.1-saas

Quick Start

Get started with NetFUNNEL 4 Cloudflare Agent in 5-10 minutes with this quick start guide.


Prerequisites

  • NetFUNNEL console access
  • Cloudflare account with Workers support
  • Domain registered with Cloudflare

Step 1: Worker Environment Setup

Set up the Cloudflare Worker environment by referring to Cloudflare's official documentation.


Step 2: Get Client ID

  1. Go to NetFUNNEL console
  2. Click the profile icon in the top right
  3. Select Integration Credentials menu
  4. Copy Client ID

Step 3: Create Worker

  1. Cloudflare console → Click [Workers and Pages] menu
  2. Click Workers [Create]
  3. Click [Hello world]
  4. Deploy to add

Step 4: Apply Agent to Worker

  1. Click [Edit code] in the top right
  2. Download netfunnel-cloudflare-agent.js file from https://agent-lib.stclab.com/agents/cdn/cloudflare/netfunnel-cloudflare-agent-latest.js
  3. Click [Explore] in the left tab of the code editor to show the file list
  4. Upload netfunnel-cloudflare-agent.js file
  5. Open worker.js file and write the following code:
import handleEvent from './netfunnel-cloudflare-agent.js'
export default {
async fetch(request, env, ctx) {
return await handleEvent(request, env, ctx);
},
};
  1. Click the [Deploy] button in the top right to deploy the Worker

Step 5: Worker Configuration

Domain and Route Configuration

  1. Select the created Worker
  2. Click [Settings] menu
  3. Click [+ Add] in Domains and routes
  4. Click [Route]
  5. Select domain in [Zone]
  6. Enter the path where the Worker will run in [Route] (add /* at the end so the Worker works on subpages as well)
  7. Select [Open on failure (continue)]
  8. Click [Add route]

Environment Variable Configuration

Add environment variables to Variables and secrets by referring to the table below.

TypeNameValue
TextCLIENT_ID{{CLIENT_ID}}

Check CLIENT_ID in the NetFUNNEL console.

After adding the variable, click [Deploy].


Step 6: Domain Configuration

  1. Go to Cloudflare DNS settings
  2. Set the domain configured in Step 5 as CNAME
  3. Must be set to Proxy type (orange cloud icon)

Next Steps