Gcore edge proxy and DNS
OpsCrew can serve your app through Gcore CDN instead of Cloudflare’s proxy — either with Gcore
hosting your DNS (dns.provider: gcore) or with an external DNS provider (dns.provider: none
with dns.edge: gcore).
Note: Interactive selection in
opscrew interview/opscrew designis not wired for Gcore yet, and combiningdns.provider: cloudflarewithdns.edge: gcoreis refused until Cloudflare DNS-only readers switch to the active edge provider. Configure Gcore directly inopscrew/plan.yamlas shown below.
Prerequisites
Section titled “Prerequisites”- A Gcore account (Gcore offers a permanent Free CDN tier of 1 TB/month and free Managed DNS).
- A permanent API token from
portal.gcore.com/accounts/profile/api-tokens
with CDN and DNS permissions, exported as
GCORE_PERMANENT_API_TOKEN. - If
dns.provider: gcore, create your domain’s DNS zone in Gcore Managed DNS before runningopscrew provision.
Configuration in opscrew/plan.yaml
Section titled “Configuration in opscrew/plan.yaml”With Gcore hosting both DNS and CDN:
dns: provider: gcore domain: app.example.com zone: example.com proxied: true www: truesecurity: httpAllowedFrom: edge wafCustomRules: trueWith external DNS in front of Gcore CDN:
dns: provider: none edge: gcore domain: app.example.com proxied: truesecurity: httpAllowedFrom: edgeOrigin protection: shared header vs mTLS + CIDR firewall
Section titled “Origin protection: shared header vs mTLS + CIDR firewall”Cloudflare and Fastly publish compact CIDR lists (~20 ranges) and support origin mTLS client
certificates, so OpsCrew restricts cloud firewall ports 80 and 443 to their CIDRs and enforces
per-app mTLS (pull.pem) on the server.
Gcore’s global PoP list is large and expands regularly, so Gcore recommends authenticating origin traffic with an unpredictable custom request header rather than static firewall IP lists:
- Cloud firewall: Ports 80 and 443 stay open (
0.0.0.0/0,::/0) so Gcore PoPs can always reach your origin over HTTPS (origin_protocol = "HTTPS"). - Shared origin-verification header (the gate): OpsCrew generates a per-app 32-byte random hex
secret (
X-OpsCrew-Origin-Token), keeps it in localgenerated_values.json(0600) and GitHub Actions (OPSCREW_EDGE_ORIGIN_TOKEN), uploads/srv/edge/tls/<app>/origin-token.<ext>(0600) on every deploy, and applies it to your Gcore CDN resource via a hash-approved API call (PATCH /cdn/resources/{id}staticRequestHeaders), preserving any custom headers you already configured. - Security trade-off (weaker than mTLS): A shared secret header is strictly weaker than mTLS
plus a CIDR firewall. Anyone who learns the
X-OpsCrew-Origin-Tokenvalue can send requests directly to your origin server around Gcore. Rotate it immediately withopscrew rotate edge-origin-tokenif you ever suspect exposure. - Never in Terraform state or git: OpsCrew intentionally does not set
gcore_cdn_resource.options.static_request_headersin Terraform, because Terraform would persist the secret in state. SecOps blocks any Terraform plan that enablesstatic_request_headersin state. - Reverse-proxy ordering and client IP semantics: On Caddy, nginx, and OpenLiteSpeed, every
request missing the exact
X-OpsCrew-Origin-Tokenvalue receives HTTP 403 before reachingkamal-proxyand before trustingX-Forwarded-For. After verification, every proxy stripsX-OpsCrew-Origin-Tokenso your app never sees it. Because Gcore appends the connecting visitor’s IP to any incomingX-Forwarded-Forheader (rather than exposing a dedicated single-IP header), apps that parseX-Forwarded-Forshould use the rightmost Gcore-appended hop rather than blindly trusting an arbitrary leftmost client-supplied entry. On OpenLiteSpeed, OpsCrew strips untrustedX-Forwarded-*headers after verifying the origin token.
Zero-downtime rotation
Section titled “Zero-downtime rotation”Rotate the origin-verification secret at any time with:
opscrew rotate edge-origin-tokenOpsCrew approves the rotation plan by its SHA-256 hash first (a refusal changes nothing), configures the server proxy to accept both tokens, switches Gcore CDN to the new token, and narrows the server proxy to the new token only. If interrupted mid-flight, re-running resumes with the recorded token pair.
Caching and probe blocking
Section titled “Caching and probe blocking”- Dynamic-safe caching: OpsCrew creates
gcore_cdn_resourcewithedge_cache_settings.enabled = falseandignore_query_string.enabled = falseso dynamic pages and query-parameterized endpoints are never cached unexpectedly. - Automated edge TLS: Terraform provisions a
gcore_cdn_sslcert(automated = true, Let’s Encrypt) bound togcore_cdn_resource(ssl_enabled = true, TLS 1.2/1.3) and points Gcore DNS CNAME records at the account’s CDN edge target (data.gcore_cdn_client.this[0].cname). - Free probe blocking: When
security.wafCustomRules: true, Terraform creates agcore_cdn_ruleusingforce_return(code = 403,Forbidden) blocking/.env,/.git/,/wp-admin,/wp-login.php,/xmlrpc.php, and/phpmyadminat the edge on the Free tier.
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 Gcore account)
Section titled “Live-pass checklist (unverified against a real Gcore account)”- Export
GCORE_PERMANENT_API_TOKENand runopscrew provisionfor a test app withdns.provider: gcore,dns.proxied: true,security.httpAllowedFrom: edge. - Verify
https://<domain>/.envreturns HTTP403at Gcore’s edge without hitting the origin. - Verify a direct request to
https://<server-ip>withoutX-OpsCrew-Origin-Tokenreturns HTTP403. - Run
opscrew rotate edge-origin-tokenand verify zero failed requests during and after rotation.