Fastly

This guide explains how to configure Fastly Compute@Edge to create a reverse proxy that serves the Didomi Consent notice from your own domain and a subdomain. Two implementation options are available based on your requirements.

Choose Your Implementation

Implementation guide

Choose Your Implementation

Option A: Use a subdomain

To implement a reverse proxy on a subdomain, you will first create a lightweight Rust application compiled to WebAssembly, then configure Fastly backends and deploy the WASM binary. This approach uses minimal edge processing with simple backend routing.

  • Customer Usage: /api/* and /sdk/* paths directly

  • Architecture: Fastly with minimal WASM processing

  • Implementation: Simple backend routing with lightweight Rust code

Option B: Use the main domain

To implement a reverse proxy on the main domain, you will first create a Rust application with URL transformation logic, then compile it to WebAssembly and deploy to Fastly Compute@Edge. The application handles /consent/* prefix removal and routes requests to appropriate Didomi backends.

  • Customer Usage: /consent/* prefix for all CMP requests

  • Architecture: Fastly Compute@Edge with full URL transformation

  • Implementation: URL transformation and advanced processing

Domain vs Subdomain Trade-offs

When implementing a reverse proxy for the Didomi SDK and its API events, you need to choose between using your main domain or a dedicated subdomain. This choice has important implications for Safari's cookie restrictions.

For more information, see this trade-off matrix to select the implementation that suits your requirements.

Implementation guide

Shared setup steps (both options)

Option A: Use a subdomain

Option B: Use the main domain

Common prerequisites (Both options)

Shared setup steps (both options)

Domain and DNS configuration

1. Domain setup in Fastly

Add domains

  1. Log into Fastly Dashboard

  2. Navigate to: Configure → Domains

  3. Add Domains: Enter both YOUR_DOMAIN_NAME and www.YOUR_DOMAIN_NAME

2. DNS configuration

For root domain (A record)

For subdomain (CNAME Record)

3. TLS Certificate configuration

Certificate subscription setup

  1. Navigate to: TLS Configuration → Certificates

  2. Create new subscription

  3. Configure subscription:

    • Domains: Enter YOUR_DOMAIN_NAME, www.YOUR_DOMAIN_NAME (comma-separated)

    • Common Name: YOUR_DOMAIN_NAME

    • Certification Authority: Let's Encrypt

    • TLS Configuration: HTTP/3 & TLS v1.3 + 0RTT (t.sni)

ACME challenge configuration

After submitting the certificate request, Fastly will provide an ACME challenge:

  1. Create DNS CNAME record:

  2. Verify DNS propagation:

  3. Certificate validation: Fastly will automatically validate domain ownership and issue the certificate

Fastly service configuration

1. Create Fastly service

Create a new Compute@Edge service in Fastly dashboard or via CLI:

2. Configure backends (Both options use same backends)

In the Fastly dashboard, configure two backends:

Backend 1: Didomi SDK

  • Name: didomi_sdk

  • Address: sdk.privacy-center.org

  • Port: 443 (HTTPS)

  • Host Header: sdk.privacy-center.org

  • Override Host: Yes

  • Use SSL: Yes

  • SSL SNI Hostname: sdk.privacy-center.org

  • SSL Certificate Hostname: sdk.privacy-center.org

Backend 2: Didomi API

  • Name: didomi_api

  • Address: api.privacy-center.org

  • Port: 443 (HTTPS)

  • Host Header: api.privacy-center.org

  • Override Host: Yes

  • Use SSL: Yes

  • SSL SNI Hostname: api.privacy-center.org

  • SSL Certificate Hostname: api.privacy-center.org


Option A: Use a subdomain

This option uses simple direct routing with minimal WASM code on a subdomain.

Step 3: Create simple implementation (src/main_simplified.rsarrow-up-right)

Step 4: Deploy option A

Step 5: Test option A


Option B: Use the main domain

This option includes URL transformation to handle /consent/* prefixes.

Prerequisites: Use the same backends and DNS setup as Option A above.

Step 1: Create fastly.tomlarrow-up-right for Option B

Step 2: Create Cargo.tomlarrow-up-right for Option B

3. Main implementation (src/main.rsarrow-up-right)

Deployment steps

1. Build the application

2. Test locally

3. Deploy to Fastly

Configuration requirements

DNS configuration

Point your domain/subdomain to Fastly:

  • Create a CNAME record pointing to your Fastly service domain

  • Or configure A records to Fastly IP addresses

SSL/TLS setup

  1. Upload SSL Certificate to Fastly (if using custom domain)

  2. Enable TLS for both backends

  3. Configure SNI for proper SSL handshake

Headers and caching

  • Cache TTL: 3600 seconds (1 hour)

  • Vary Header: Accept-Encoding, Accept-Language

  • CORS: Enabled for cross-origin requests

  • Cache TTL: 0 (no caching)

  • Cache-Control: no-cache, no-store, must-revalidate

  • CORS: Enabled with appropriate headers


circle-check

Last updated