Initialization Settings
This document explains Lambda config settings and additional features available in NetFUNNEL CloudFront Agent.
Lambda Config Settings
Control the behavior of the NetFUNNEL agent through the config object in the Lambda function's index.mjs file.
Required Settings
clientID
Enter the client ID issued from the NetFUNNEL console.
const config = {
clientID: "{{CLIENT_ID}}",
}
Configuration steps:
- Open
index.mjsfile in Lambda function - Enter Client ID from NetFUNNEL console in
clientIDofconfigobject - Click [Deploy] button
- [Versions] tab → Click [Publish new version]
- Update Lambda function version in CloudFront and perform invalidation
Additional Features
Good Bot Exception Handling
You can exclude specific User-Agent values from agent behavior through Lambda settings.
Lambda Configuration
const config = {
clientID: "{{CLIENT_ID}}",
goodBots: ["Googlebot", "Bingbot", "Slurp", "Applebot", "facebookexternalhit"],
}
Example: Example code that excludes Google, Microsoft, Yahoo, Apple, and Facebook bots.
Configuration steps:
- Open
index.mjsfile in Lambda function - Add User-Agents of good bots to exclude as an array in
goodBotsofconfigobject - Click [Deploy] button
- [Versions] tab → Click [Publish new version]
- Configure CloudFront and perform invalidation
CloudFront Configuration
- Select CloudFront Distribution with Lambda@Edge applied
- Select an item in [Behaviors] tab and click [Edit]
- Update viewer request and viewer response to new version in Function associations at the bottom
- Click [Save changes]
CloudFront Invalidation
- Click [Invalidations] tab
- Click [Create invalidation]
- Object paths: Enter
/* - Click [Create invalidation]
Entry Key Automatic Return Processing
NetFUNNEL CloudFront agent automatically returns the NetFUNNEL key after entry to allow the next person in queue to enter. This feature can be used when you want to return the NetFUNNEL key at the timeout time set in the segment instead of returning it immediately.
Lambda Configuration
const config = {
clientID: "{{CLIENT_ID}}",
returnKey: true,
}
true(default): The agent automatically returns the NetFUNNEL key after waiting is complete and entry.false: The key is returned at the timeout time set in the segment.
Configuration steps:
- Open
index.mjsfile in Lambda function - Enter
trueorfalseinreturnKeyofconfigobject - Click [Deploy] button
- [Versions] tab → Click [Publish new version]
- Configure CloudFront and perform invalidation
CloudFront Configuration
- Select CloudFront Distribution with Lambda@Edge applied
- Select an item in [Behaviors] tab and click [Edit]
- Update viewer request and viewer response to new version in Function associations at the bottom
- Click [Save changes]
CloudFront Invalidation
- Click [Invalidations] tab
- Click [Create invalidation]
- Object paths: Enter
/* - Click [Create invalidation]
Waiting Room Domain Change
The domain of the NetFUNNEL waiting room page is agent-lib.stclab.com. To change this domain to match your service domain, contact the NetFUNNEL service team with your desired domain and change the Lambda settings.
Lambda Configuration
const config = {
clientID: "{{CLIENT_ID}}",
vwrPageDomain: "https://wait.stclab.com",
}
Example: Example code that changes the waiting room domain to wait.stclab.com.
Configuration steps:
- Open Lambda function applied to viewer-request
- Open
index.mjsfile - Enter the waiting room address you want to change in
vwrPageDomainofconfigobject - Click [Deploy] button
- [Versions] tab → Click [Publish new version]
- Configure CloudFront and perform invalidation
CloudFront Configuration
- Select CloudFront Distribution with Lambda@Edge applied
- Select an item in [Behaviors] tab and click [Edit]
- Update viewer request and viewer response to new version in Function associations at the bottom
- Click [Save changes]
CloudFront Invalidation
- Click [Invalidations] tab
- Click [Create invalidation]
- Object paths: Enter
/* - Click [Create invalidation]
Cookie Domain Configuration
When storing keys issued by the NetFUNNEL server in cookies, they are stored based on the current page's domain. If you need to share keys between different subdomains, configure it so that the main domain is stored in cookies.
Example: Set to .stclab.com so that cookies are shared between pages with different subdomains such as develop.stclab.com and staging.stclab.com.
Lambda Configuration
const config = {
clientID: "{{CLIENT_ID}}",
cookieDomain: ".stclab.com",
}
Example: Example code that changes the cookie domain to .stclab.com.
Configuration steps:
- Open Lambda function applied to viewer-request
- Open
index.mjsfile - Enter in
.MAIN_DOMAINformat incookieDomainofconfigobject - Click [Deploy] button
- [Versions] tab → Click [Publish new version]
- Configure CloudFront and perform invalidation
CloudFront Configuration
- Select CloudFront Distribution with Lambda@Edge applied
- Select an item in [Behaviors] tab and click [Edit]
- Update viewer request and viewer response to new version in Function associations at the bottom
- Click [Save changes]
CloudFront Invalidation
- Click [Invalidations] tab
- Click [Create invalidation]
- Object paths: Enter
/* - Click [Create invalidation]
Lambda Function Deployment and CloudFront Invalidation
After changing Lambda config, you must perform the following steps for the changes to take effect.
- Click [Deploy] button in Lambda function
- [Versions] tab → Click [Publish new version]
- Update Lambda function version in CloudFront Distribution
- Perform CloudFront invalidation
Related Documentation
- Installation and Initialization: Basic Lambda config settings
- Troubleshooting: Common issues and solutions