Fastly edge proxy
OpsCrew can serve your app through Fastly instead of Cloudflare’s proxy. Because Fastly does not
host authoritative DNS zones, you pair dns.edge: fastly with a supported DNS host
(dns.provider: bunny or gcore).
Note: Interactive selection in
opscrew interview/opscrew designis not wired for Fastly yet, and combiningdns.provider: cloudflarewithdns.edge: fastlyis refused until Cloudflare DNS-only readers switch to the active edge provider. Configure Fastly directly inopscrew/plan.yamlas shown below.
Prerequisites
Section titled “Prerequisites”- A Fastly account (Fastly’s free developer tier includes up to 5 managed TLS domains, 100 GB egress, and 1M requests/month).
- A Fastly API token from
manage.fastly.com/account/personal/tokens
with global write scope, exported as
FASTLY_API_KEY. - Authoritative DNS hosted at
bunnyorgcore(and that DNS host’s API token).dns.provider: nonewithdns.edge: fastlyis refused because someone must host the DNS records pointing at Fastly.
Configuration in opscrew/plan.yaml
Section titled “Configuration in opscrew/plan.yaml”With Bunny DNS (or Gcore DNS) in front of Fastly:
dns: provider: bunny # or "gcore" edge: fastly domain: app.example.com zone: example.com proxied: true www: truesecurity: httpAllowedFrom: edge wafCustomRules: trueOrigin protection: compact CIDRs + origin mTLS
Section titled “Origin protection: compact CIDRs + origin mTLS”Like Cloudflare, Fastly gives OpsCrew both layers of origin protection:
- Compact CIDR cloud firewall: Fastly publishes ~18 IPv4 and 2 IPv6 CIDRs at
https://api.fastly.com/public-ip-list. OpsCrew restricts cloud firewall ports 80 and 443 to Fastly’s CIDRs only, configures Caddy and nginx to trustFastly-Client-IPstrictly from those CIDRs, and configures OpenLiteSpeed (useIpInProxyHeader 2) to trustX-Forwarded-Forfrom those CIDRs. - Origin TLS & mTLS (
pull.pem): Because the cloud firewall blocks public port 80 (so the origin cannot run HTTP-01 ACME), OpsCrew generates a per-app P-256 origin server certificate (signed by a per-app CA) and client certificate (pull.pem) locally ingenerated_values.json(0600). The server’s reverse proxy serves the origin certificate (OPSCREW_ORIGIN_TLS) and requirespull.pem; after Terraform apply, OpsCrew installsssl_ca_cert,ssl_client_cert,ssl_client_key, and reconciles the backend’s originaddresson Fastly’sopscrew_originbackend via a plan-hash-approved Fastly API sequence (clone active version -> update backend -> activate). Refusing this post-apply mTLS approval leaves Fastly returning HTTP503until approved because the origin requirespull.pemand Fastly has not yet pinned the origin CA. - Never written by Terraform & protected at rest: OpsCrew omits
backend.ssl_client_keyfromfastly_service_vclin Terraform (SecOps blocks any Terraform plan settingssl_client_keyas acriticalfinding) and setslifecycle { ignore_changes = [backend] }onfastly_service_vclso subsequent applies never wipe mTLS or trigger a 503 window. OpsCrew registers the client private key with its redactor before running OpenTofu/Terraform; when using OpenTofu (OpsCrew’s default), state encryption protects any refreshed provider state at rest, whereas plain Terraform does not encrypt local state.
Caching, TLS, and free probe blocking
Section titled “Caching, TLS, and free probe blocking”- Dynamic-safe pass & HTTPS: OpsCrew creates
fastly_service_vclwithrequest_setting { action = "pass", force_ssl = true }so dynamic responses are not cached by default and HTTP visitors are redirected to HTTPS. - Verified origin TLS: The
opscrew_originbackend usesuse_ssl = true,ssl_check_cert = true, and matchesssl_cert_hostname/ssl_sni_hostnameto your domain, verified against OpsCrew’s per-app origin CA pinned viassl_ca_cert. - Managed edge TLS & split DNS routing:
fastly_tls_subscriptionprovisions managed HTTPS certificates for your domain (andwww.<domain>when enabled). The paired DNS module (Bunny DNS or Gcore DNS) automatically creates the ACME DNS validation records frommanaged_dns_challengesplus the routing records pointing at Fastly’s edge (Flatten/CNAMEon Bunny; anycastA/AAAAat apex andCNAMEon subdomains on Gcore), andfastly_tls_subscription_validationwaits for validation to complete. - Free VCL probe blocking: When
security.wafCustomRules: true, Terraform adds a VCLconditionandresponse_objectreturning HTTP403 Forbiddenat Fastly’s edge for/.env,/.git/,/wp-admin,/wp-login.php,/xmlrpc.php, and/phpmyadmin.
What stays Cloudflare-only
Section titled “What stays Cloudflare-only”Cloudflare-specific products remain on Cloudflare: Cloudflare Tunnel, Cloudflare Access / Zero
Trust, Cloudflare Workers hosting, R2 object storage, Cloudflare Registrar, Workers uptime checks,
and preview environments (environment.previews).
Live-pass checklist (unverified against a real Fastly account)
Section titled “Live-pass checklist (unverified against a real Fastly account)”- Export
FASTLY_API_KEY(and your Bunny/Gcore DNS token) and runopscrew provisionfor a test app withdns.provider: bunny(orgcore),dns.edge: fastly,dns.proxied: true,security.httpAllowedFrom: edge. - Approve the Terraform plan (creates the Fastly VCL service, Bunny/Gcore edge routing + ACME DNS
validation records, and waits for
fastly_tls_subscription_validation), then approve the Fastly origin mTLS plan (pinsssl_ca_cert+ssl_client_cert+ssl_client_keyonopscrew_origin). - Verify
https://<domain>/.envreturns HTTP403at Fastly’s edge without hitting the origin. - Verify a direct connection to port 443 on the server IP from outside Fastly’s CIDRs is blocked by
the cloud firewall, and a connection without the
pull.pemclient cert fails TLS handshake. - Verify during the live pass whether Fastly’s
GET /backendmasks or returnsssl_client_keyon OpenTofu refresh, and confirm a subsequentopscrew provisionpreserves mTLS without HTTP 503.