Engineering

Cloudflare Workers VPC Adds Custom CA and mTLS Support, Ending verify_ca Workarounds for Private Origins

Previously, connecting Cloudflare Workers VPC to internal APIs or private databases signed by an enterprise CA meant downgrading TLS verification to verify_ca or disabled—and origins requiring client certificates were unreachable. On November 18, 2026, Cloudflare added custom CA and mutual TLS (mTLS) client certificate support across both HTTP and TCP VPC Services, including Hyperdrive PostgreSQL connections to Amazon RDS. Here is how the certificate architecture works, how to configure it with Wrangler 4.164.0+ or Terraform 5.29.0+, and how to audit existing services.

By 0xScorPionSon

11 min read

Cloudflare Workers VPC Adds Custom CA and mTLS Support, Ending verify_ca Workarounds for Private Origins

Cloudflare Workers VPC mTLS and Custom CA architecture infographic

Executive Summary

On November 18, 2026, Cloudflare shipped Custom CA and client certificates (mTLS) for Workers VPC, closing a long-standing security gap for edge-to-private-network connectivity. Previously, Workers VPC Services only trusted publicly trusted certificate authorities (such as Let's Encrypt or DigiCert) and Cloudflare Origin CA certificates. Any engineering team connecting a Cloudflare Worker or Hyperdrive pool to an internal API, an enterprise PKI-signed service, or an Amazon RDS PostgreSQL instance using a private CA bundle had to weaken transport verification by setting --cert-verification-mode to verify_ca (skipping hostname checks) or disabled (skipping certificate verification entirely). Origins that enforced mutual TLS (mTLS) client authentication were unreachable through Workers VPC.

With the November 18, 2026 update, platform teams can upload custom CA roots and client leaf certificates to their Cloudflare account and bind them directly to individual VPC Services using Wrangler 4.164.0 or later, the Cloudflare REST API, or Cloudflare Terraform provider 5.29.0 or later. These TLS settings apply to both https connections on http VPC Services and upstream TLS connections on tcp VPC Services, including PostgreSQL databases routed through Hyperdrive.

Confidence note: All protocol support, CLI flags, API endpoints, and configuration constraints in this analysis are verified directly against Cloudflare's November 18, 2026 changelog, cloudflare/workers-sdk release notes, and official Workers VPC and Hyperdrive documentation. Because Cloudflare has not published latency or throughput benchmarks for custom CA or mTLS handshakes in Workers VPC, performance overhead is not quantified here.


Why verify_ca Was a Risky Compromise

Workers VPC is designed to let edge Workers reach private network resources through cloudflared tunnels without exposing entire subnets or requiring Cloudflare Access service tokens for every internal hop. As documented in Cloudflare's VPC Services guide (updated October 12, 2026), Workers VPC enforces destination pinning: the hostname or IPv4/IPv6 address and port configured on the VPC Service always govern the underlying tunnel route, preventing Server-Side Request Forgery (SSRF) even if Worker code passes a different URL to fetch().

However, transport-layer trust lagged behind network-layer isolation. As noted in Cloudflare's Hyperdrive private database guide (updated April 30, 2026), Workers VPC defaults to verify_full—verifying both the certificate chain and the hostname—unlike standard Hyperdrive origins, which do not verify origin server certificates by default. Because Workers VPC lacked a custom trust store, any private database or internal microservice presenting a certificate signed by an internal corporate CA (for example, HashiCorp Vault PKI, AWS Private CA, or the Amazon RDS CA bundle) failed the verify_full TLS handshake.

Teams faced two unattractive options:

  1. Downgrade to verify_ca: The tunnel verified that a certificate chained up to a trusted root, but skipped hostname verification. Even then, if the private CA itself was not in Cloudflare's default public trust store, the chain check failed unless teams fell back to disabled.
  2. Downgrade to disabled: Disabling certificate verification entirely allowed the connection to succeed, but exposed the last-mile hop between cloudflared and the origin service to potential origin impersonation on the internal network.
  3. Skip mTLS origins altogether: Internal services configured to reject connections without a valid client certificate could not authenticate Workers VPC at all.

The November 18, 2026 release eliminates these compromises by letting operators supply both a custom trust anchor and a client identity per VPC Service while keeping verify_full enabled.


Technical Mechanics and Architecture

In a Workers VPC deployment, TLS termination and re-origination happen at the boundary between the Cloudflare edge, the VPC Service control plane, and the cloudflared tunnel daemon running inside your private network. When a Worker invokes a VPC Service binding (for HTTP/HTTPS) or connects through a Hyperdrive binding backed by a TCP VPC Service, traffic travels encrypted over the Cloudflare Tunnel to cloudflared, which establishes the upstream connection to your private origin.

+-------------------+       +-------------------+       +------------------------+
| Cloudflare Worker |       |   Hyperdrive      |       |  VPC Service           |
| (Edge Isolate)    |------>| (Optional Pool)   |------>|  tls_settings:         |
| env.PRIVATE_API   |       | --service-id      |       |  - ca_cert_uuid        |
| env.HYPERDRIVE    |       +-------------------+       |  - client_cert_uuid    |
+-------------------+                                   |  - mode: verify_full   |
                                                        +-----------+------------+
                                                                    |
                                                        Encrypted Cloudflare Tunnel
                                                                    |
                                                        +-----------v------------+
                                                        | cloudflared Daemon     |
                                                        | (Private VPC / On-Prem)|
                                                        +-----------+------------+
                                                                    |
                              +-------------------------------------+
                              | TLS Handshake (HTTPS or TCP/PostgreSQL)
                              | 1. Origin presents Server Cert -> Verified vs Custom CA + Hostname
                              | 2. Origin requests Client Cert -> VPC presents mTLS Client Cert
                              v
                  +-----------------------+
                  | Private Origin        |
                  | - Internal HTTPS API  |
                  | - RDS / PostgreSQL    |
                  +-----------------------+

Key Architectural Behaviors

According to Cloudflare's November 18, 2026 changelog and the cloudflare/workers-sdk release notes, the TLS subsystem enforces several strict rules:

  • Per-service isolation: TLS settings are scoped strictly to each VPC Service. Host objects and resolver networks do not carry TLS settings and do not inherit certificates across services.
  • Plaintext HTTP vs. HTTPS: For http VPC Services, custom CA and client certificate settings apply only to https connections, not plaintext http requests. When using https, the hostname passed to fetch() populates the Host header and Server Name Indication (SNI) value, while routing still uses the VPC Service's configured host and port.
  • TCP and Hyperdrive integration: For tcp VPC Services (such as PostgreSQL on port 5432), upstream TLS uses the custom CA and client certificate configured on the VPC Service. Notably, the Cloudflare Terraform cloudflare_hyperdrive_config documentation explicitly states that Hyperdrive's own mtls attribute cannot be used with VPC Service origins—TLS must be managed directly on the VPC Service itself.
  • Independent or combined flags: Operators can attach a custom CA alone, a client certificate alone, or both together.

Step-by-Step Configuration (Wrangler 4.164.0+)

First, upload your private CA certificate and, if the origin requires mTLS, your client certificate and private key using wrangler cert upload (verified in Cloudflare's November 18, 2026 changelog):

# 1. Upload the private or RDS CA certificate bundle
npx wrangler cert upload certificate-authority \
  --ca-cert ./ca.pem \
  --name private-ca

# 2. Upload the mTLS client certificate and private key
npx wrangler cert upload mtls-certificate \
  --cert ./client.pem \
  --key ./client-key.pem \
  --name private-client

Each upload returns a certificate UUID. Reference those UUIDs when creating a new VPC Service—for example, a private PostgreSQL database with full verification and mTLS enabled:

# 3. Create a TCP VPC Service with Custom CA, mTLS, and verify_full
npx wrangler vpc service create private-db \
  --type tcp \
  --tcp-port 5432 \
  --app-protocol postgresql \
  --hostname db.internal.example \
  --tunnel-id <TUNNEL_ID> \
  --certificate-authority <CA_CERTIFICATE_ID> \
  --client-certificate <CLIENT_CERTIFICATE_ID> \
  --cert-verification-mode verify_full

If your origin uses a publicly trusted server certificate (or Cloudflare Origin CA) and only needs mTLS client authentication, omit --certificate-authority and pass only --client-certificate <CLIENT_CERTIFICATE_ID> --cert-verification-mode verify_full.

REST API Certificate Upload

For automated pipelines or custom tooling that bypasses Wrangler, certificates are uploaded via the Cloudflare mTLS Certificates API (POST /accounts/{account_id}/mtls_certificates). This endpoint requires an API token with the Account: SSL and Certificates Write permission. Set "ca": true when uploading a root CA certificate, or "ca": false with both "certificates" and "private_key" when uploading a client leaf certificate.

Worker Binding and Defensive Code Usage

Once the VPC Service is created, bind it in wrangler.jsonc (for an HTTP service) or attach its service_id to Hyperdrive (for a PostgreSQL service). In Worker code, keep error handling defensive so TLS handshake failures fail closed rather than falling back to insecure endpoints:

// src/index.ts — Defensive HTTPS call over a Workers VPC Service binding
interface Env {
  PRIVATE_API: Fetcher;
}

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    try {
      // Routing uses the VPC Service host/port; URL host sets SNI & Host header
      const upstreamResponse = await env.PRIVATE_API.fetch(
        "https://api.internal.example/v1/health",
        {
          method: "GET",
          headers: { "Accept": "application/json" },
          signal: request.signal,
        }
      );

      if (!upstreamResponse.ok) {
        return Response.json(
          { error: "Upstream service rejected request", status: upstreamResponse.status },
          { status: 502 }
        );
      }

      return upstreamResponse;
    } catch (err) {
      // TLS verification or mTLS handshake failures surface as fetch() exceptions
      console.error("VPC Service TLS/connection failure:", err instanceof Error ? err.message : err);
      return Response.json({ error: "Private origin unavailable" }, { status: 503 });
    }
  },
} satisfies ExportedHandler<Env>;

Evidence: Verification Modes and Allowed Combinations

Cloudflare's documentation and workers-sdk release notes define three TLS verification modes and strict validation rules around how custom CAs and client certificates interact with them.

Verification Mode Chain Verified? Hostname Verified? Allowed with Custom CA? Allowed with Client Cert (mTLS)? Production Guidance
verify_full Yes Yes Yes Yes Recommended default for all production HTTP and TCP VPC Services
verify_ca Yes No Yes Yes Weakens origin identity checks; use only if SAN/CN cannot match internal hostname
disabled No No No (rejected) No recommended use Allows impersonated origins; restrict strictly to isolated local/dev testing

Operational Constraints Verified in Release Notes

  1. Incompatible combination blocked: Per the cloudflare/workers-sdk release notes, a custom CA cannot be combined with --cert-verification-mode disabled. Attempting to pair a trust anchor with disabled verification is rejected by validation.
  2. Explicit mode required on cert flags: Whenever you pass --certificate-authority or --client-certificate to wrangler vpc service create or update, you must explicitly specify --cert-verification-mode (verify_full, verify_ca, or disabled).
  3. Certificate rotation and removal semantics: To rotate a certificate without downtime, upload the replacement CA or client certificate first to obtain a new UUID, then run wrangler vpc service update with the new UUID. To remove a custom CA while retaining an mTLS client certificate, run wrangler vpc service update passing only --client-certificate <CLIENT_UUID> and the desired --cert-verification-mode.
  4. Tooling minimums: Custom CA and mTLS configuration for Workers VPC requires Wrangler 4.164.0 or later, the Cloudflare REST API, or Cloudflare Terraform provider 5.29.0 or later.
  5. No published benchmarks: Cloudflare's November 18, 2026 announcement does not report handshake latency deltas or connection-per-second throughput numbers for custom CA or mTLS sessions over cloudflared. Teams migrating high-concurrency workloads should baseline p95 connection setup times in staging, particularly when Hyperdrive connection pooling is not in front of a TCP origin.

Hardening Playbook

Use the following numbered steps to migrate existing Workers VPC Services off verify_ca or disabled and enforce mutual TLS where required.

1. Audit Existing VPC Services for Weak TLS Modes

List all configured VPC Services and inspect their tls_settings to identify any service running verify_ca or disabled.

# List all VPC Services in the account
npx wrangler vpc service list

# Inspect a specific VPC Service's TLS settings
npx wrangler vpc service get <SERVICE_ID>

You can also query the Connectivity Directory REST API directly in CI/CD compliance checks to flag any service where cert_verification_mode is not verify_full:

curl -sS -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/connectivity/directory/services" \
  | jq '.result[] | {id, name, type, tls_settings}'

2. Verify Origin SANs Before Enabling verify_full

Before switching a service from verify_ca to verify_full, confirm that the origin server certificate's Subject Alternative Name (SAN) matches the --hostname configured on the VPC Service (or the hostname passed in fetch()). For Amazon RDS, verify that your VPC Service uses the DNS hostname rather than a bare private IP if the RDS certificate is issued for the RDS endpoint hostname.

3. Validate and Upload Certificates with Least Privilege

Ensure the operator or CI/CD service account holds both Connectivity Directory Admin (to create or update VPC Services) and Account: SSL and Certificates Write (to upload certificates via /mtls_certificates). Inspect certificate expiration dates locally before uploading:

# Verify CA and client certificate validity windows before upload
openssl x509 -in ./ca.pem -noout -subject -issuer -dates
openssl x509 -in ./client.pem -noout -subject -issuer -dates

Upload both certificates using wrangler cert upload certificate-authority and wrangler cert upload mtls-certificate, and record the returned UUIDs in your infrastructure-as-code state.

4. Update the VPC Service to verify_full

Apply the custom CA and/or client certificate UUIDs to the target VPC Service:

npx wrangler vpc service update <SERVICE_ID> \
  --name private-db \
  --type tcp \
  --tcp-port 5432 \
  --app-protocol postgresql \
  --hostname db.internal.example \
  --tunnel-id <TUNNEL_ID> \
  --certificate-authority <CA_CERTIFICATE_ID> \
  --client-certificate <CLIENT_CERTIFICATE_ID> \
  --cert-verification-mode verify_full

5. Monitor for Handshake Failures After Cutover

Watch Worker logs (npx wrangler tail) and cloudflared daemon logs immediately after updating the service. An untrusted intermediate CA, expired client leaf, or SAN mismatch will cause fetch() to throw an exception on HTTP services or Hyperdrive connection attempts to fail on TCP services.

6. Rollback Procedure

If a production service fails TLS negotiation after enabling verify_full—for example, due to an unexpected internal SAN mismatch—you can temporarily revert the verification mode while keeping the custom CA attached:

npx wrangler vpc service update <SERVICE_ID> \
  --name private-db \
  --type tcp \
  --tcp-port 5432 \
  --app-protocol postgresql \
  --hostname db.internal.example \
  --tunnel-id <TUNNEL_ID> \
  --certificate-authority <CA_CERTIFICATE_ID> \
  --cert-verification-mode verify_ca

Treat verify_ca strictly as a temporary rollback state until the origin certificate SAN is reissued to match the VPC Service hostname.


Frequently Asked Questions

Can I use a custom CA with Workers VPC without enabling mTLS client certificates?

Yes. Cloudflare supports using a custom CA alone, a client certificate alone, or both together. If your private origin only needs server identity verification against an internal PKI or the Amazon RDS CA bundle, pass --certificate-authority <CA_UUID> with --cert-verification-mode verify_full and omit --client-certificate.

Does Hyperdrive's mtls setting work with a Workers VPC Service origin?

No. According to Cloudflare's cloudflare_hyperdrive_config Terraform documentation, Hyperdrive's native mtls configuration cannot be combined with VPC Service origins. When Hyperdrive connects to a private database through a TCP VPC Service, all custom CA and mTLS client certificate settings must be configured directly on the VPC Service.

What happens if I try to combine a custom CA with cert-verification-mode disabled?

Wrangler and the Workers VPC API reject that configuration. Because disabled skips server certificate verification entirely, supplying a custom CA trust anchor is contradictory and disallowed.

Which Wrangler and Terraform versions are required?

Cloudflare specifies Wrangler 4.164.0 or later and Cloudflare Terraform provider 5.29.0 or later, alongside direct REST API support.

Does Workers VPC support mTLS for plaintext HTTP services?

No. Custom CA and mTLS client certificate settings apply only to encrypted https connections on http VPC Services and TLS-encrypted connections on tcp VPC Services. Plaintext http connections between cloudflared and the origin do not perform TLS negotiation.


Sources

  1. Cloudflare Developer Docs — Custom CA and client certificates (mTLS) for Workers VPC (Published November 18, 2026)
  2. GitHub (cloudflare/workers-sdk) — Wrangler Releases: Workers VPC custom CA and client certificate flags (Accessed November 18, 2026)
  3. Cloudflare Developer Docs — VPC Services Configuration (Updated October 12, 2026)
  4. Cloudflare Developer Docs — Connect to a private database using Workers VPC (Hyperdrive) (Updated April 30, 2026)
  5. Cloudflare API Reference — Upload mTLS certificate (POST /accounts/{account_id}/mtls_certificates) (Accessed November 18, 2026)
  6. Terraform Registry (cloudflare/cloudflare) — cloudflare_hyperdrive_config Resource Documentation (Published November 11, 2026)

More on Engineering

Engineering

Microsoft agent-framework PyPI Hijack: .pth Startup Execution & Cloud Credential Theft

On November 17, 2026, attackers published two hijacked releases (1.26.1 and 1.26.2) of Microsoft's official agent-framework PyPI package during a ~45-minute window. Both releases dropped .pth startup hooks that execute on any Python invocation—even pip—to harvest environment variables, credential files, Azure IMDS tokens, and CI OIDC credentials before exfiltrating them to webhook.site.

11 min read

Engineering

Kubernetes 1.38 Enters Code Freeze Ahead of December 16: Breaking Removals, DRA Graduations, and Gang Scheduling Status

Kubernetes 1.38 has entered code and test freeze ahead of its planned December 16, 2026 release, locking down scope around v1.38.0-beta.0. While AI workload primitives like CompositePodGroup (v1beta1) and DRA Device Binding Conditions (GA) advance, several removed feature gates and stricter JWK/kubelet validations will break unverified upgrades. Here is what actually shipped in the 1.38 changelog, how the scheduling architecture works, and how to test your clusters before December 16.

9 min read

Tell us what is not working

A thirty-minute call, no deck and no obligation. You will leave with a straight answer about whether this is worth building - including if that answer is no.

Start a project

Direct line

hello@codebumble.net
Dhaka, Bangladesh  :   local timeCalls in English or Bangla