Fastly Agent
Overview
The NetFUNNEL Fastly agent is a NetFUNNEL-dedicated client that communicates with the NetFUNNEL server from Fastly Compute Services.
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 the serverUrl domain in Hostname, and click [Add].
- 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 the settingUrl domain 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 CLIENT_ID.
- You can find CLIENT_ID in the NetFUNNEL console.
Link Config Store
- 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 netfunnel-fastly-agent.tar file from https://agent-lib.stclab.com/agents/cdn/fastly/netfunnel-fastly-agent-latest.tar
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-Rust"
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 deploy
Additional Features
Good Bot Exception
You can exclude specific User-Agent values from agent behavior through Config Store 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.
Example that excludes Google, Microsoft, Yahoo, Apple, and Facebook bots.
| Key | Value |
|---|---|
| GOOD_BOTS | Googlebot, 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 Fastly agent automatically returns the NetFUNNEL 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 RETURN_KEY (value: true).
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, contact the NetFUNNEL service team with your desired domain and update the Config Store 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.
| Key | Value |
|---|---|
| VWR_PAGE_DOMAIN | http(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.
Cookie Domain Configuration
Keys issued by the NetFUNNEL server are stored in cookies based on the current page domain. To share keys across different subdomains, configure the main domain to be stored in the cookie.
Set to .stclab.com so that cookies are shared across pages with different subdomains, such as develop.stclab.com and staging.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.
| Key | Value |
|---|---|
| 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.