Web Server & Proxy Integration

Integrate EdgeNonce seamlessly into Apache, IHS, or Nginx, whether as a caching layer or a standalone on-premises nonce injector sitting behind your Cloudflare Worker service at https://edge-nonce.com.

1. Caching Origin (AEM Dispatcher / mod_cache)

Because the AEM plugin outputs a static placeholder CF_EDGE_NONCE, your HTML pages remain 100% cacheable in the Dispatcher or mod_cache layers. To prevent conflicts, configure Apache to strip backend CSP headers:

# httpd.conf configuration
<IfModule mod_headers.c>
    Header unset Content-Security-Policy
</IfModule>

2. Local Nonce Generation & Injection (IHS 9 / Apache 2.4)

For standalone, on-premises setups, use Apache's output filter chain to substitute the placeholder with the request's unique ID environment variable:

# Substitute placeholder with UNIQUE_ID
<Location "/">
    Options +Includes
    AddOutputFilterByType SUBSTITUTE;INCLUDES text/html
    Substitute "s|CF_EDGE_NONCE|<!--#echo var=\"UNIQUE_ID\" -->|ni"
</Location>

3. Nginx Caching Origin

When using Nginx as a caching reverse proxy (e.g., proxy_cache), ensure that backend CSP headers generated by AEM or upstream origins are stripped out to prevent cache-poisoning conflicts with the edge-injected headers.

# nginx.conf location block
location / {
    proxy_pass http://aem_backend;
    proxy_hide_header Content-Security-Policy;
}

4. Nginx Local Injection

To inject nonces natively on Nginx without an edge worker, use the sub_filter module to dynamically replace the placeholder with Nginx's built-in unique request ID.

# Inject unique request ID as nonce
location / {
    sub_filter 'CF_EDGE_NONCE' $request_id;
    sub_filter_once off;
    sub_filter_types text/html;
}

5. Cloudflare Worker Upstream (Proxy to edge-nonce.com)

If you want your on-premises web server to explicitly route traffic through the EdgeNonce Cloudflare service, configure your server to proxy_pass traffic to https://edge-nonce.com. This allows internal corporate networks to leverage the Cloudflare edge injection.

# Nginx configuration for upstream EdgeNonce proxy
location / {
    proxy_pass https://edge-nonce.com;
    proxy_set_header Host edge-nonce.com;
    proxy_ssl_server_name on;
}

6. Drupal & Varnish Caching Origin

Drupal emits the static placeholder CF_EDGE_NONCE, enabling 100% cache hit ratios across Drupal Internal Page Cache and upstream Varnish. Strip backend CSP headers in Varnish:

# default.vcl configuration for Drupal
sub vcl_backend_response {
    unset beresp.http.Content-Security-Policy;
    set beresp.ttl = 1d;
}
📖

Full Integration Documentation Available

Need the complete configuration files, filter ordering specifications for IHS 8 (Apache 2.2), or Drupal 9/10/11 module setups? View our complete offline Apache & IBM HTTP Server (IHS) Guide or our dedicated Drupal Integration Guide.