Fastly (BYOCDN)

This configuration routes agentic traffic (requests from AI bots and LLM user agents) to the Edge Optimize backend service (live.edgeoptimize.net). Human visitors and SEO bots continue to be served from your origin as usual. To test the configuration, after the setup is complete, look for the header x-edgeoptimize-request-id in the response.

Prerequisites

Before setting up the Fastly VCL rules, ensure you have:

  • Access to Fastly for your domain.
  • Completed the LLM Optimizer onboarding process.
  • Completed CDN log forwarding to LLM Optimizer.
  • An Edge Optimize API key retrieved from the LLM Optimizer UI.
  • (Optional) A staging Edge Optimize API key if you test routing on a staging hostname first.

Steps to retrieve your production Edge Optimize API key:

  1. In LLM Optimizer, open Customer configuration and select the CDN configuration tab.

    Navigate to Customer Configuration

  2. Locate the Deploy optimizations to AI agents section. Tick the Enable optimization engine checkbox.

    Deploy optimizations to AI agents — pending

  3. In the confirmation dialog, select Enable.

    Enable optimization engine confirmation dialog

  4. Select View details. In the Deploy optimizations details dialog, copy the Production API key (use Copy next to the field).

    Production API key in Deploy optimizations details

    note
    NOTE
    The dialog may show that setup is not complete. This is expected until routing is verified — you can still copy the API key so your IT or CDN team can finish the configuration.

Additionally, if you require any help with the above steps, reach out to your Adobe account team or llmo-at-edge@adobe.com.

Use a staging hostname when you want to test Optimize at Edge in a lower environment before production traffic uses the routing rules.

Prerequisites

  • The staging hostname must belong to the same registrable domain as your production site (for example, https://staging.example.com when production is https://www.example.com).
  • Only one staging domain can be configured for the site. After it is saved, it cannot be changed without assistance.

Steps

  1. In LLM Optimizer, open Customer configuration and select the CDN configuration tab.

  2. In the Deploy optimizations to AI agents section, select Add stage domain (or Stage domain if a staging domain is already configured).

  3. In the Stage Domain dialog, enter the full staging URL including https:// and select Set Domain.

    Stage Domain input dialog

  4. Confirm the domain in the next prompt. When the workflow completes, the Stage Domains dialog shows the configured domain and its API key. Select Copy to copy the staging API key.

    Staging domain API key

If you need help, contact llmo-at-edge@adobe.com.

Configuration

Add the following three VCL snippets to your Fastly service. These snippets handle routing agentic requests to Edge Optimize, cache-key separation, and failover to your default origin.

Fastly VCL

Add VCL snippets

vcl_recv snippet

unset req.http.x-edgeoptimize-url;
unset req.http.x-edgeoptimize-config;
unset req.http.x-edgeoptimize-api-key;

if (!req.http.x-edgeoptimize-request
    && req.http.user-agent ~ "(?i)(AdobeEdgeOptimize-AI|ChatGPT-User|GPTBot|OAI-SearchBot|PerplexityBot|Perplexity-User)") {
  set req.http.x-forwarded-host = req.http.host; # required for identifying the original host
  set req.http.x-edgeoptimize-url = req.url; # required for identifying the original url
  set req.http.x-edgeoptimize-config = "LLMCLIENT=TRUE;"; # required for cache key
  set req.http.x-edgeoptimize-api-key = "<YOUR API KEY>"; # required for identifying the client
  set req.backend = F_EDGE_OPTIMIZE;
}

vcl_hash snippet

if (req.http.x-edgeoptimize-config) {
  set req.hash += "edge-optimize";
  set req.hash += req.http.x-edgeoptimize-config;
}

vcl_deliver snippet

if (req.http.x-edgeoptimize-config && resp.status >= 400) {
  set req.http.x-edgeoptimize-request = "failover";
  set req.backend = F_Default_Origin;
  restart;
}

if (!req.http.x-edgeoptimize-config && req.http.x-edgeoptimize-request == "failover") {
  set resp.http.x-edgeoptimize-fo = "1";
}

Failover

The vcl_deliver snippet handles failover automatically. If Edge Optimize returns a 4XX or 5XX error, the request is restarted and routed back to your default origin so the end-user still receives a response. Failover responses include the x-edgeoptimize-fo: 1 header.

Scenario
Behavior
Edge Optimize returns 2XX
Optimized response is served to the client.
Edge Optimize returns 4XX or 5XX
Request is restarted and served from the default origin.
Failover response
Includes the header x-edgeoptimize-fo: 1.

Verify the setup

After completing the setup, verify that bot traffic is being routed to Edge Optimize and that human traffic remains unaffected.

1. Test bot traffic (should be optimized)

Simulate an AI bot request using an agentic user-agent:

curl -svo /dev/null https://www.example.com/page.html \
  --header "user-agent: chatgpt-user"

A successful response includes the x-edgeoptimize-request-id header, confirming that the request was routed through Edge Optimize:

< HTTP/2 200
< x-edgeoptimize-request-id: 50fce12d-0519-4fc6-af78-d928785c1b85

2. Test human traffic (should NOT be affected)

Simulate a regular human browser request:

curl -svo /dev/null https://www.example.com/page.html \
  --header "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"

The response should not contain the x-edgeoptimize-request-id header. The page content and response time should remain identical to before enabling Optimize at Edge.

3. How to differentiate between the two scenarios

Header
Bot traffic (optimized)
Human traffic (unaffected)
x-edgeoptimize-request-id
Present — contains a unique request ID
Absent
x-edgeoptimize-fo
Present only if failover occurred (value: 1)
Absent

4. Staging domain (optional)

If you use a staging hostname and staging API key from LLM Optimizer, add the same VCL snippets to your staging Fastly service using the staging API key. Then verify bot traffic on the staging host:

curl -svo /dev/null https://staging.example.com/page.html \
  --header "user-agent: chatgpt-user"

Replace https://staging.example.com/page.html with your real staging URL and path. A successful response includes the x-edgeoptimize-request-id header.

The status of the traffic routing can also be checked in the LLM Optimizer UI. Navigate to Customer configuration and select the CDN configuration tab.

Deploy optimizations to AI agents — completed

To learn more about Optimize at Edge, including available opportunities, auto-optimization workflows, and FAQs, return to the Optimize at Edge overview.

recommendation-more-help
llm-optimizer-help-main-toc