Skip to main content
Version: 4.6.2-saas

Fastly Agent

Overview

Seamlessly integrated with NetFUNNEL in the Fastly Compute environment, the agent controls the queue in real time at the frontline where user requests originate.

Compute Service Configuration

Create Compute Service

  • In the Fastly console, go to [Compute].
  • Click [Create service] at the top right.
  • Select [+ Use starter kit].
  • Enter a name in Service name and the domain to apply Compute to in Add your own domain, then click [Next: Choose a starter kit].
  • Select Default starter for Rust and click [Finalize and deploy].

Register CNAME

  • When deploy is complete, check Point your custom domain to Fastly under Additional setup.
  • Click [Issue TLS Certification].
  • In Your DNS provider, select the service where your domain is registered and add the CNAME there.

Service Configuration

Click [Edit configuration] (or [Service configuration]), then click [Clone version 1 (active) to edit]. (Fastly Compute requires cloning to a new version each time you make changes.)

Create nf_core host

  • Select the Origins menu, enter {CLIENT_ID}.netfunnel.stclab.com in Hostname, and click [Add].
    • You can find CLIENT_ID in the NetFUNNEL console.
    • If CLIENT_ID is stclab-0000, then Hostname is stclab-0000.netfunnel.stclab.com.
  • Select the host you just created and go to the Edit page.
  • Change Name to nf_core and click [Update].

Create nf_setting host

  • Click [+ Create a host], enter nf-setting-bucket.stclab.com in Hostname, and click [Add].
  • Select the host you just created and go to the Edit page.
  • Change Name to nf_setting and click [Update].

Create origin host

  • Click [+ Create a host], enter your origin address in Hostname, and click [Add].
  • Select the host you just created and go to the Edit page.
  • Change Name to origin and click [Update].

Activate

  • Click [Activate] at the top right to save.

Config Store Configuration

Create Config Store

  • Under Resources > Config stores, click [+ Create store] at the top right.
  • Enter nf_config_store in Store name and click [Create].
  • Click [Add item] and add the items from the table below.
info

You can find CLIENT_ID in the NetFUNNEL console.

KeyValue
CLIENT_IDCLIENT_ID
  • Select the [Linked Services] tab at the top and click [Link service].
  • Select the Compute service you created above and click [Next].
  • Click [Link and activate].
  • When the Active Service Versions window appears, click [Confirm and activate].

Create Token

  • Go to Account - API tokens - Personal tokens.
  • Click [+ Create Token] at the top right.
  • Click [Continue] and log in again.
  • Enter a Name, set Expiration to Never expire, then click [Create Token].

Deploy Agent

Install Agent Files and Packages

  • Install the package for the Fastly CLI.
brew install fastly/tap/fastly
  • Download the agent file through your inquiry.

Edit toml File

  • Extract the downloaded agent archive.
  • Open the fastly.toml file.
  • Copy the Compute service ID from the Fastly console.
  • Paste the copied ID into the cloned_from and service_id values.
authors = []
cloned_from = "{SERVICE_ID}"
description = "Fastly agent for NetFUNNEL - Rust implementation"
language = "rust"
manifest_version = 3
name = "netfunnel-fastly-agent"
service_id = "{SERVICE_ID}"

Deploy Agent to Compute

  • Open a terminal in the netfunnel-fastly-agent folder and run the command below to deploy the agent code to Compute.
fastly compute build
fastly compute deploy

Additional Features

Good Bot Exception

When the User-Agent contains a Good Bot identifier keyword, the request is excluded from agent control.

Config Store Configuration

  • Under Resources > Config stores, select the store used by the agent.
  • Click [+ Add item] and add the items from the table below.
info

Example that excludes Google, Microsoft, Yahoo, Apple, and Facebook bots.

KeyValue
GOOD_BOTSGooglebot, Bingbot, Slurp, Applebot, facebookexternalhit

Compute Purge

  • Under Compute > Compute Services, select the service with the agent applied.
  • Click [Purge] and select [Purge all].
  • Enter the service name and click the [Purge all] button.

Entry Key Auto-Return

The NetFUNNEL agent automatically returns the issued key after entry so the next user in line can enter. Use this feature when you want the key to be returned at the segment timeout instead of returning it immediately.

Config Store Configuration

  • Under Resources > Config stores, select the store used by the agent.
  • Click [+ Add item] and add the items from the table below.
KeyValue
RETURN_KEYtrue
info

When set to true (default), the agent automatically returns the NetFUNNEL key when the user enters after waiting. When set to false, the key is returned at the timeout configured in the segment.

Compute Purge

  • Under Compute > Compute Services, select the service with the agent applied.
  • Click [Purge] and select [Purge all].
  • Enter the service name and click the [Purge all] button.

Change Waiting Room Domain

The domain of the NetFUNNEL waiting room page is agent-lib.stclab.com. To change it to your service domain, request your desired domain and also add it to the configuration.

Config Store Configuration

  • Under Resources > Config stores, select the store used by the agent.
  • Click [+ Add item] and add the items from the table below.
KeyValue
VWR_PAGE_DOMAINhttp(s)://{CNAME_DOMAIN} e.g. https://wait.stclab.com

Compute Purge

  • Under Compute > Compute Services, select the service with the agent applied.
  • Click [Purge] and select [Purge all].
  • Enter the service name and click the [Purge all] button.

The NetFUNNEL agent stores the issued key in cookies based on the current page domain after entry. To share keys across different subdomains, configure the main domain to be stored in the cookie.

info

Set to .stclab.com so that cookies are shared across pages with different subdomains, such as netfunnel.stclab.com and botmanager.stclab.com.

Config Store Configuration

  • Under Resources > Config stores, select the store used by the agent.
  • Click [+ Add item] and add the items from the table below.
KeyValue
COOKIE_DOMAIN.{MAIN_DOMAIN} e.g. .stclab.com

Compute Purge

  • Under Compute > Compute Services, select the service with the agent applied.
  • Click [Purge] and select [Purge all].
  • Enter the service name and click the [Purge all] button.