Apache HTTP Server

This configuration applies when Apache HTTP Server acts as the reverse proxy in front of your origin (a self-hosted setup, without AEM Dispatcher). It 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.

The integration is a set of native Apache Include files — there is no code or worker to deploy. You download three files, set your API key, and add two Include lines to your virtual host.

Prerequisites

Before you set up the Apache routing rules, ensure you have:

  • Apache HTTP Server 2.4 or later with these modules enabled: proxy, proxy_http, ssl, rewrite, headers, env, and setenvif.
  • Access to your Apache configuration (the <VirtualHost> for your site) and the ability to reload Apache.
  • An Edge Optimize API key retrieved from the LLM Optimizer UI. For steps, see Retrieve your API keys.
  • (Optional) To test staging routing, see Staging API key.

Configuration

1. Download the configuration files

Download the three Edge Optimize include files from the Optimize at Edge code samples repository and place them in a directory on your Apache server (for example, conf/oae/):

File
Purpose
oae-routing.conf
Detects AI bots, injects the Edge Optimize headers, routes HTML page requests to the backend, and sets up cache isolation and failover.
oae-failover.conf
Replays the original request against your origin if Edge Optimize returns an error.
domains.conf
Enables Optimize at Edge per domain and holds your API key.

You do not need to modify oae-routing.conf or oae-failover.conf — use them as-is.

2. Enable your domain and set the API key (domains.conf)

Edit domains.conf and add one line per domain you are enabling. Replace the host with your domain and YOUR_API_KEY with the key from the LLM Optimizer UI. Domains not listed route to origin unchanged, so you can enable one domain at a time.

SetEnvIfExpr "%{HTTP_HOST} =~ m#(?i)^(www\.)?example\.com(:\d+)?$#" OAE_DOMAIN_ENABLED=1 OAE_API_KEY=YOUR_API_KEY

3. Include the files in your virtual host

Add the two Include lines to your existing <VirtualHost *:443>. The routing file goes before your rewrite and ProxyPass rules; the failover file goes after them. In the example below, lines marked #NEWLINE are the only lines you add for Optimize at Edge — everything else (ServerName, ProxyPass, and the rest) is your existing, unchanged configuration.

Define OAE_CONF_DIR conf/oae                       #NEWLINE  directory holding the OAE include files

<VirtualHost *:443>
    ServerName www.example.com

    Include "${OAE_CONF_DIR}/oae-routing.conf"     #NEWLINE  OAE routing — BEFORE your Rewrite & ProxyPass rules

    # --- your existing rewrite rules and ProxyPass to origin ---
    ProxyPass        "/" "https://www.example.com/"
    ProxyPassReverse "/" "https://www.example.com/"

    Include "${OAE_CONF_DIR}/oae-failover.conf"    #NEWLINE  OAE failover — AFTER your ProxyPass rules
</VirtualHost>

4. Reload Apache

Validate the configuration and reload Apache to apply the changes.

NOTE
Bot-optimized and human responses are kept in separate cache entries automatically (the routing file sets Vary: x-edgeoptimize-config). If your Apache already uses mod_cache, ensure it has CacheQuickHandler Off so the cache lookup runs after the Edge Optimize headers are set.

Allow Optimize at Edge through firewall rules (optional)

If your CDN uses a WAF or Bot Manager:

  • Allowlist the *AdobeEdgeOptimize/1.0* user agent in your WAF or Bot Manager so the Optimize at Edge service can fetch your origin content.

  • If your firewall requires additional verification beyond user agent, generate a secret (for example, openssl rand -hex 32) and:

    • Add x-edgeoptimize-fetcher-key with the secret in your routing rules alongside the other x-edgeoptimize-* headers.
    • Add a WAF or Bot Manager rule to allow requests where x-edgeoptimize-fetcher-key matches the same secret.
  • Optimize at Edge forwards this header as-is — you own the full key lifecycle.

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

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