Configuration settings
How to configure and customize Optimizely Edge Agent.
Beta
Optimizely Edge Agent is in beta. Apply on the Optimizely beta signup page or contact your Customer Success Manager.
Optimizely Edge Agent is a versatile solution that lets you configure and customize your experimentation and personalization efforts. The agent operates in the following two modes:
- Edge mode for handling
GET
requests. - Agent mode for handling
POST
requests.
See the Two modes of Optimizely Edge Agent documentation for more.
Configuration methods
You can configure the Optimizely Edge Agent using three different methods:
- HTTP Headers – Pass configuration settings as HTTP headers in the request, supported for edge mode (
GET
requests) and agent mode (POST
requests). - Query Parameters – Pass configuration settings as query parameters in the request URL, supported for edge mode and agent mode.
- JSON Body (agent mode only) – Pass configuration settings as a JSON object in the request body, supported for agent mode.
Priority of configuration settings
When Optimizely Edge Agent processes a request, it reads the configuration settings in the following order of priority:
- HTTP Headers – The agent first checks for configuration settings in the HTTP headers. If it finds a setting in the headers, that setting takes precedence over the same setting defined in query parameters or the JSON body.
- Query Parameters – If it does not find a configuration setting in the HTTP headers, the agent checks the query parameters. If it finds a setting in the query parameters not defined in the headers, it uses that setting.
- JSON Body (agent mode only) – If it does not find a configuration setting in the headers or query parameters, the agent looks for it in the JSON body of the request.
By following this order, Optimizely Edge Agent lets you have granular control over the configuration settings so you can override settings at various levels based on their specific requirements.
requestConfig.js
module
requestConfig.js
moduleThe requestConfig.js
module reads and sets the necessary configuration settings that Optimizely Edge Agent uses to operate. It handles the extraction and parsing of configuration settings from the request's headers, query parameters, and JSON body (in agent mode).
In addition to the standard configuration settings, you can add any custom configuration settings you want to use in your specific implementation. The requestConfig
object accessible in every handler and module throughout Optimizely Edge Agent automatically contains these custom settings.
This lets you have flexibility and extensibility to define and utilize their own configuration settings based on their specific requirements. The requestConfig
object acts as a centralized repository for all configuration settings, making it convenient to access and use them in various parts of the codebase.
To add custom configuration settings, you can include them in the request's headers, query parameters, or JSON body (in agent mode), following the same format as the standard configuration settings. The requestConfig.js
module automatically extracts and parses these custom settings, making them readily available in the requestConfig
object.
With this capability, Optimizely Edge Agent lets you tailor the behavior and functionality of your implementation according to your specific needs for customization and adaptability.
The requestConfig.js
module performs the following tasks:
- Initializes the request configuration based on headers, query parameters, and the JSON body for
POST
requests in agent mode. - Defines the set of supported query parameters for configuration.
- Initializes metadata configuration for logging and debugging purposes.
- Initializes configuration settings from HTTP headers.
- Initializes configuration settings from URL query parameters.
- Loads the request body and initializes configuration settings from it, if the request method is
POST
and the content type is JSON (agent mode).
By centralizing the configuration handling in the requestConfig.js
module, Optimizely Edge Agent ensures consistent and efficient settings management across different modes and request methods.
Configuration settings
The following table provides an overview of the available configuration settings for Optimizely Edge Agent.
Setting | Description | Headers | Query Parameters | JSON Body |
---|---|---|---|---|
sdkKey | The datafile SDK key for the Optimizely project. | Yes | Yes | Yes |
overrideCache | Indicates whether to override the cache. | Yes | Yes | Yes |
overrideVisitorId | Indicates whether to override the visitor ID. Every request generates a new visitor ID. Used for development and testing. | Yes | Yes | Yes |
attributes | Custom attributes and audience conditions for the visitor. | Yes | No | Yes |
eventTags | Event tags for tracking and reporting. | Yes | No | Yes |
datafileAccessToken | Access token for retrieving the datafile. | Yes | No | No |
enableOptimizelyHeader | Indicates whether to enable Optimizely Experimentation. | Yes | No | No |
decideOptions | Options for the decide function. | Yes | No | No |
visitorId | The visitor ID for the request. | Yes | Yes | Yes |
trimmedDecisions | Indicates whether to trim the decisions. | Yes | Yes | Yes |
enableFlagsFromKV | Indicates whether to enable feature flags from the key-value store. | Yes | No | Yes |
eventKey | The event key for tracking and reporting. | Yes | Yes | Yes |
datafileFromKV | Indicates whether to retrieve the datafile from the key-value store. | Yes | No | Yes |
enableRespMetadataHeader | Indicates whether to enable response metadata. | Yes | No | No |
setResponseCookies | Indicates whether to set response cookies with bucketing decisions. | Yes | Yes | Yes |
setResponseHeaders | Indicates whether to set response headers with bucketing decisions. | Yes | Yes | Yes |
setRequestHeaders | Indicates whether to set request headers with bucketing decisions. | Yes | Yes | Yes |
setRequestCookies | Indicates whether to set request cookies with bucketing decisions. | Yes | Yes | Yes |
serverMode | The server mode for the agent (Edge or Agent). | No | Yes | No |
flagKeys | The specific flag keys to evaluate. | No | Yes (multi-valued) | Yes |
enableResponseMetadata | Indicates whether to enable response metadata. | Yes | Yes | Yes |
decideAll | Indicates whether to evaluate all flag keys. | No | Yes | Yes |
disableDecisionEvent | Indicates whether to disable the decision event. | No | Yes | Yes |
enabledFlagsOnly | Indicates whether to return only enabled flag keys. | No | Yes | Yes |
includeReasons | Indicates whether to include reasons for flag decisions. | No | Yes | Yes |
ignoreUserProfileService | Indicates whether to ignore the user profile service. | No | Yes | Yes |
excludeVariables | Indicates whether to exclude variables from the response. | Yes | Yes | Yes |
forcedDecisions | Forced decisions for specific flag keys. | No | No | Yes |
Updated 13 days ago