Back to Cloudflare

Capstone A: Secure and Accelerate an Existing Website

November 4, 2026 Updated November 6, 2026 Wasil Zafar 40 min read

Deliver a measured zone configuration and a recovery-ready runbook

Table of Contents

  1. Define the Site, Baseline, and Acceptance Criteria
  2. Design the DNS, TLS, and Origin Boundary
  3. Implement Cache, Performance, and Security Policies
  4. Prepare an Incident and Recovery Runbook
  5. Build the Controlled Website Delivery Configuration
  6. Submit Measurements, Negative Tests, and a Rollback Demonstration

Define the Site, Baseline, and Acceptance Criteria

A shop cannot close for a month while it installs a security desk. The owner adds the desk on Monday, the parcel locker on Wednesday, and the cameras on Friday, testing after each change and keeping the old keys behind the counter. A website move to Cloudflare has the same shape. The unit of work is not "the configuration" but a sequence of small, reversible changes, each with an observation that proves it did what you intended.

The subject is fieldnote.example, a subscription publishing site. One nginx host runs the application, and media sits in object storage behind the same hostname. DNS is at the registrar, the origin has a Let's Encrypt certificate, and there is no CDN. The owner wants fewer origin requests, a smaller attack surface, and the ability to undo any change in minutes.

Five surfaces share that hostname, and each has a different cache and trust requirement:

  • / and /blog/* — marketing copy and articles, public and cacheable.
  • /login — the form that starts a session.
  • /account/* — billing details for one signed-in reader at a time.
  • /api/v1/* — JSON for the mobile client.
  • /assets/* — fingerprinted CSS, JavaScript, and images.

Some terms carry the rest of the article:

  • A zone is the domain plus its DNS records and settings inside Cloudflare. The zone is not the origin (the server that holds the application and data).
  • A proxied record (the orange cloud) makes DNS answer with Cloudflare addresses, so HTTP traffic passes through the edge, Cloudflare's anycast network where TLS terminates, rules evaluate, and cache lives.
  • A cache key is the identity of a stored object; if two requests produce the same key, the second can receive the first response. Time to live (TTL) is how long that copy may be reused.
  • A WAF inspects requests for attack patterns; a managed ruleset is a vendor-maintained collection of those rules.
  • Authenticated Origin Pulls (AOP) makes Cloudflare present a client certificate to your origin, so the origin can reject connections that did not come through the edge.

The mental model is a chain of five decisions, not a stack of products. DNS decides where the name points. TLS decides whether both legs are encrypted and whether the origin is verified. Security rules decide whether the request continues. Cache decides whether the origin is contacted at all. The origin ingress decides whether a connection is allowed even when every earlier decision was skipped. Figure 1 draws the chain and its failure exits.

Define the Site, Baseline, and Acceptance Criteria
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    subgraph PUB["Public network"]
        V["Visitor browser"]
        DNS["Proxied DNS record returns an edge address"]
    end
    subgraph EDGE["Cloudflare edge: inspected path"]
        TLS["Edge TLS termination"]
        SEC["WAF, bot rules, rate limit"]
        KEY{"Cache key present?"}
        HIT["Response served from edge"]
        STOP["403 or challenge page"]
        STORE["Store under the cache key"]
    end
    subgraph ORIG["Origin network: your trust boundary"]
        CONN["Origin connection: Full strict plus AOP"]
        ING{"Client certificate valid?"}
        REJECT["TLS handshake rejected"]
        APP["Application authorizes the session"]
        CLASS{"Response class"}
        PRIV["Return private, no-store"]
    end
    V --> DNS
    DNS --> TLS
    TLS --> SEC
    SEC -->|"block or challenge"| STOP
    SEC -->|"allow"| KEY
    KEY -->|"HIT"| HIT
    KEY -->|"MISS"| CONN
    CONN --> ING
    ING -->|"no"| REJECT
    ING -->|"yes"| APP
    APP --> CLASS
    CLASS -->|"public, no Set-Cookie"| STORE
    CLASS -->|"private or Set-Cookie"| PRIV
    HIT --> V
    STOP --> V
    PRIV --> V
    classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
    classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
    classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
    classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
    classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
    class DNS,TLS,SEC,CONN primary;
    class V,KEY,STOP,STORE,APP,PRIV secondary;
    class HIT,ING,CLASS ok;
    class REJECT danger;

Two properties matter. First, the cache decision uses a key the origin does not automatically control. A response can be correct for one visitor and catastrophic for another if the key omits the input that made it personal. Second, the ingress decision is the only control that still applies when someone bypasses DNS. A WAF rule that never sees a request is not a control; it is a log line that never happens.

Figure 2 shows the same system as layers with owners. The public network, the edge, and the origin network are separate trust domains. The edge team owns TLS mode, WAF, bot rules, rate limits, and cache policy. The platform team owns the origin certificate, the listener, and the ingress check. The product team owns what the application puts in a response, including Set-Cookie and Cache-Control. Most incidents here come from one team changing a layer another team assumed was stable.

Three trust domains: public network, Cloudflare edge, and origin network A visitor resolves a proxied DNS record to a Cloudflare anycast address, passes edge TLS and security rules, then reaches a cache lookup. A miss continues to the origin, where an ingress check verifies the AOP client certificate before the application reads session data. A dashed path shows a direct connection to the origin IP, which the ingress check rejects. Public network Cloudflare edge Origin network Visitor browser plus session Proxied DNS returns anycast IP A grey-cloud record skips every edge control TLS termination edge certificate and mode WAF, bot rules, rate limit security before cache Cache lookup by key a HIT stops here Logs, analytics, trace cf-ray joins the layers Ingress check client certificate plus source nginx plus application Session store and database private data boundary No inbound listener when Tunnel is used 443 TLS direct to origin IP: rejected by mTLS

Before touching a setting, record a baseline. For seven days, capture requests by path class, cache hit ratio for /assets/*, p95 time to first byte, origin 5xx rate, WAF actions, bot challenges, and login success rate. The baseline is the only way to distinguish "the change helped" from "traffic shifted." Store the raw export with the date and zone ID.

Acceptance criteria make the project falsifiable. Each has an observation, not an opinion:

  • AC-1, transport: the apex and www return a 301 to HTTPS, and HSTS carries a max-age of at least six months.
  • AC-2, origin identity: the zone uses Full (strict), and the origin rejects TLS without the configured AOP certificate.
  • AC-3, public cache: a second asset request returns CF-Cache-Status: HIT with Age, and /assets/* reaches an 80% hit ratio after warmup.
  • AC-4, private isolation: two sessions requesting /account/billing receive different bodies, and neither response is a HIT or carries Age.
  • AC-5, deception resistance: /account/billing.css and /account/billing with Accept: text/css are not served from cache.
  • AC-6, abuse control: the sixth login POST from one address within ten seconds is challenged or blocked, while a normal login succeeds.
  • AC-7, recovery: disabling the newest cache or WAF rule restores prior behavior within five minutes, with timestamps.

Recovery is the criterion most projects skip. A configuration you cannot reverse is not finished; it is a bet.

Design the DNS, TLS, and Origin Boundary

The first design decision is not a Cloudflare toggle. It is a sentence: "My origin accepts connections only from the edge, and only over verified TLS." Everything else follows from how you enforce that sentence.

Start with DNS. Proxy the apex and www, and keep the origin hostname out of public DNS. A proxied record changes the answer from your server's address to Cloudflare anycast addresses, which is what puts the edge in the path. The proxy hides the address; it does not erase it. Historical records, certificate-transparency logs, forgotten staging names, and scans can still reveal it, which is why Part 9 treats discovery as expected. If the origin must be reachable by name, put it behind a Tunnel or restrict it at the network layer.

Then TLS. Full (strict) encrypts both legs and validates the certificate the origin presents. The certificate must be unexpired, match the hostname Cloudflare requests, and chain to a public CA or to Cloudflare Origin CA (Full (strict)). The default Universal SSL certificate covers the apex and first-level subdomains; deeper names need a deliberate certificate plan. If validation fails, visitors see 526, and the origin may log nothing because the handshake never became an HTTP request.

Both halves of the boundary are testable from outside. Proxy the apex and www, then prove that the origin certificate validates for the hostname the edge requests.

# Proxy the apex and www. The origin hostname stays out of public DNS.
resource "cloudflare_dns_record" "apex" {
  zone_id = var.zone_id
  name    = "fieldnote.example"
  type    = "A"
  content = "203.0.113.10"
  proxied = true
  ttl     = 1
}

resource "cloudflare_dns_record" "www" {
  zone_id = var.zone_id
  name    = "www"
  type    = "CNAME"
  content = "fieldnote.example"
  proxied = true
  ttl     = 1
}
# Proxied means the public answer is an edge address, not the origin.
dig +short A fieldnote.example @1.1.1.1

# Full (strict) needs a valid chain for the hostname Cloudflare requests.
openssl s_client -connect 203.0.113.10:443 \
  -servername fieldnote.example -verify_return_error </dev/null

# The edge path is live only when the response carries a Ray ID.
curl -sI https://fieldnote.example/ | grep -i '^cf-ray:'

Now the worked comparison. Suppose /account/billing sets a session cookie and returns a billing address. Six plausible designs behave very differently.

DesignWhat it provesWhat it leaves openOperational costFirst failure symptom
DNS-only, grey cloudNothing at the edge; the origin address is publicTLS, WAF, cache, and DDoS absorption are all yours to runCertificate and patch management on the originNo cf-ray; clients connect straight to the origin
Proxied with FlexibleThe browser-to-edge leg is encryptedEdge-to-origin is plaintext; the origin certificate is not verified; direct access still worksLow, but the origin must accept HTTPRedirect loop when the origin forces HTTPS
Proxied with FullBoth legs are encryptedThe origin certificate is not verified, and a direct client can still connectOrigin certificate installation525 when the origin handshake fails
Full (strict), no AOPBoth legs are encrypted and the origin identity is verifiedA direct request to a discovered origin address is still acceptedCertificate lifecycle and renewal526 on expiry or hostname mismatch
Full (strict) with zone-level AOPThe request presented your account's client certificate at the originSource addresses may still be reachable; the global AOP certificate is shared across accountsClient certificate on the origin, renewal, and reload526 when the origin does not trust the client CA
Cloudflare TunnelThe origin has no public inbound listenerThe connector host becomes a new trust anchor; AOP is incompatible with TunnelRun, monitor, and upgrade cloudflared1033 or a tunnel-down error

Read the table by the second column, not the first. "Encrypted" and "private" are different claims. Flexible encrypts the browser leg and then speaks plain HTTP to the origin; a direct request to the origin IP still works. Full encrypts both legs but does not verify the origin certificate, and a direct request still works. Only the ingress check changes what an attacker can do after discovering the address. Figure 3 traces the allowed path and the two failure branches.

Design the DNS, TLS, and Origin Boundary
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
sequenceDiagram
    autonumber
    participant B as Browser
    participant E as Cloudflare edge
    participant O as Origin
    participant A as Attacker with origin IP
    B->>E: GET /account/billing with session cookie
    E->>E: WAF, bot rules, rate limit
    alt blocked
        E-->>B: 403 or challenge page
    else allowed
        E->>O: HTTPS request plus AOP client certificate
        alt certificate missing or untrusted
            O-->>E: TLS alert
            E-->>B: 526 Invalid SSL certificate
        else certificate valid
            O->>O: Authorize session and read one billing row
            O-->>E: 200 with private Cache-Control and Set-Cookie
            E->>E: Cache key check: private response is not stored
            E-->>B: 200 with CF-Cache-Status DYNAMIC
        end
    end
    A->>O: Direct GET with a spoofed CF-Connecting-IP
    O-->>A: TLS handshake rejected

The 526 branch is the most common self-inflicted outage in this project, and it is not a cache problem. The origin certificate expired, the hostname does not match, an intermediate is missing, or the origin expects a client certificate that Cloudflare is not presenting.

526 is not a cache problem

A 526 appears after the edge reached the origin and the origin certificate failed validation. A 525 means the TLS handshake failed before any certificate was checked. Both are transport faults: purging the cache or loosening a Cache Rule will not clear them, and the fix belongs in the certificate chain or the origin's client-certificate trust store.

AOP has three scopes, and the difference matters. The global scope uses a certificate shared across all Cloudflare accounts; it proves the request came through Cloudflare's network, not your zone. Zone-level AOP uses a certificate you upload, exclusive to your account. Per-hostname AOP applies your certificate to specific hostnames. Use one of the latter two when "from Cloudflare" is not a strong enough statement (Authenticated Origin Pulls). AOP is available to all plans, but it requires Full or Full (strict) and is not compatible with Cloudflare Tunnel. Tunnel is the stronger design when you can run it, because the origin has no public listener to bypass.

Isolation is proved with two sessions, not by reading a rule. Sign in as user A and user B in separate cookie jars, request the same private URL from each, and compare the headers and the bodies.

# Two identities, one URL: the bodies and headers must differ.
curl -sS -b jar-a.txt -D head-a.txt https://fieldnote.example/account/billing -o body-a.html
curl -sS -b jar-b.txt -D head-b.txt https://fieldnote.example/account/billing -o body-b.html

# Pass: DYNAMIC or BYPASS, no Age, cookie preserved, different bodies.
grep -iE '^(cf-cache-status|age|set-cookie|cf-ray):' head-a.txt head-b.txt
shasum -a 256 body-a.html body-b.html

# Cache deception: a private page dressed as CSS must never be a HIT.
curl -sSI -H 'Accept: text/css' https://fieldnote.example/account/billing.css

A single HIT on a private route is a stop-work condition, not a tuning opportunity. Part 12 develops the key design, and Part 14 covers purging.

Also test the bypass yourself. Resolve the origin address from an old record or a staging name and send a request with CF-Connecting-IP: 127.0.0.1. If the origin answers, the edge policy is advisory; the fix belongs at the origin, not in another WAF rule.

The product boundary belongs in the plan, not in a demo. AOP is available to all plans; zone-level and per-hostname certificates are the account-exclusive options. Smart Shield is opt-in for all customers through paid packages, but Smart Shield Advanced, including Regional Tiered Cache and Cache Reserve, is Enterprise-only (Smart Shield packages). API Shield's full suite and Bot Management are Enterprise products; Bot Management is an add-on. Rate-limit counts and periods vary: one rule on Free, two on Pro, five on Business, contract-dependent on Enterprise (rate limiting availability). Write the plan next to each control rather than discovering the gap during a demo.

Implement Cache, Performance, and Security Policies

With the boundary fixed, policies become named rules. Name every rule with a stable identifier, because an identifier is what you put in a change record and a rollback instruction. The set below is intentionally small. A capstone that ships forty rules has not designed a policy; it has accumulated one.

Four cache controls cover the site, and each one answers a different question. CR-1 makes fingerprinted assets cheap to serve. CR-2 makes anonymous blog HTML cacheable without ever storing a signed-in reader's page. CR-3 removes private surfaces from consideration before a broader rule can reach them. CR-4 ties the stored object to the response content type, so a .css suffix cannot smuggle HTML into cache.

resource "cloudflare_ruleset" "cache" {
  zone_id = var.zone_id
  name    = "capstone cache policy"
  phase   = "http_request_cache_settings"
  kind    = "zone"

  rules = [
    {
      ref         = "CR-1"
      description = "Immutable assets: fingerprinted filenames only"
      expression  = "(http.request.uri.path matches \"^/assets/\")"
      action      = "set_cache_settings"
      action_parameters = {
        cache       = true
        edge_ttl    = { mode = "override_origin", default = 31536000 }
        browser_ttl = { mode = "override_origin", default = 31536000 }
        cache_key = {
          custom_key = {
            # Key stays host plus path; ignore every query string except v.
            query_string = { include = { list = ["v"] } }
          }
        }
      }
    },
    {
      ref         = "CR-2"
      description = "Anonymous blog HTML only; never a session"
      expression  = "(http.request.uri.path matches \"^/blog/\") and not http.cookie contains \"session=\" and not http.request.headers[\"authorization\"]"
      action      = "set_cache_settings"
      action_parameters = {
        cache       = true
        edge_ttl    = { mode = "override_origin", default = 300 }
        browser_ttl = { mode = "override_origin", default = 60 }
        serve_stale = { disable_stale_while_updating = false }
        cache_key = {
          # CR-4: deception armor is this flag, not a separate rule.
          cache_deception_armor = true
        }
      }
    },
    {
      ref         = "CR-3"
      description = "Private surfaces bypass cache before any broader rule"
      expression  = "(http.request.uri.path matches \"^/(account|checkout|api)/\") or (http.request.uri.path eq \"/login\")"
      action      = "set_cache_settings"
      action_parameters = { cache = false }
    },
  ]
}
# MISS, then HIT, for a fingerprinted asset.
curl -sSI https://fieldnote.example/assets/app.abc123.css | grep -i '^cf-cache-status'
curl -sSI https://fieldnote.example/assets/app.abc123.css | grep -iE '^(cf-cache-status|age):'

# Anonymous blog HTML may be a HIT; a signed-in request must not be.
curl -sSI https://fieldnote.example/blog/hello | grep -i '^cf-cache-status'
curl -sSI -b jar-a.txt https://fieldnote.example/blog/hello | grep -i '^cf-cache-status'

Fingerprinted filenames are the precondition for CR-1. If a filename can change content in place, a one-year TTL is a one-year bug. For CR-2, the cookie and authorization exclusions are the security control; the five-minute TTL is only freshness (Cache Rules settings).

Origin headers have to cooperate with the rule. Public assets return Cache-Control: public, max-age=31536000, immutable, private routes return private, no-store, and static responses set no cookies.

Set-Cookie is a safety net, not a caching strategy. Cloudflare will not store a response that carries the header by default, which explains most "why is my hit ratio zero?" reports. A Cache Rule can make a response eligible, but a no-store response still returns BYPASS (cache responses). Fix the origin header instead of overriding it at the edge.

Performance policy is deliberately boring. Enable Brotli and HTTP/3, keep the origin connection alive, and remove render-blocking third-party scripts before adding more edge features. Measure p95 time to first byte and the cache hit ratio by path class, not a single site-wide average; a 90% hit ratio driven by tiny assets can coexist with a slow checkout. Part 15 covers the measurement discipline; the capstone needs only the before-and-after pair.

Security policy is staged in seven moves, and each move has an owner and a rollback line. Observe first, enforce second, narrow third; log mode is a timed observation window, not a destination.

IDControlSettingPass evidenceRollback lever
SEC-1Managed ruleset, observeCloudflare Managed Ruleset in log mode for seven daysActions reviewed by rule ID, path, and countryThe window ends with no block live
SEC-2Managed ruleset, enforceBlock, with narrow exceptions for the admin upload path and multipart API endpoints; ruleset version and date recordedThe regression list passes and every exception is namedSwitch the ruleset back to log
SEC-3Login rate limitFree: five POSTs per IP in ten seconds, then a ten-second block. Pro or Business: longer window and a managed challenge, because shared NAT can punish a whole officeThe sixth POST is challenged or blocked; a normal login still succeedsDisable the rule
SEC-4API rate limit/api/v1/* at sixty requests per minute per IP, or ten per ten seconds on Free; a higher ceiling for authenticated clients where the plan allows counting by headerA burst is limited while a token-bearing client keeps workingDisable the rule
SEC-5Bot controlsBot Fight Mode on Free, or Super Bot Fight Mode on Pro and above with verified bots allowedSearch indexing and ordinary browsers still passTurn the mode off
SEC-6TurnstileLogin and contact forms, with the token validated server-sideA forged token is rejected at the server, not only in the browserRemove the widget and the server check
SEC-7Browser policyHSTS at six months without preload; CSP in report-only for two weeks; nosniff, strict-origin-when-cross-origin, and a restrictive Permissions-PolicyHeaders present on HTML; CSP reports reviewed, not ignoredShorten HSTS and drop CSP to report-only

Bot Management scoring is an Enterprise add-on and should not appear in the plan unless it is licensed. The same discipline applies to HSTS: six months without preload until every subdomain is ready.

Figure 4 assigns each decision to a layer and shows the private path end to end.

Ownership matrix for a private request and its rollback levers Columns show the visitor, Cloudflare edge, origin, and application. The request row shows WAF and cache-bypass decisions before the origin ingress check and session authorization. The response row shows that a private response with Set-Cookie is not stored and returns CF-Cache-Status DYNAMIC. The rollback row names the smallest reversible lever owned by each layer. Visitor Cloudflare edge Origin Application and data Request GET /account/billing session cookie browser cache first WAF, bot rules, rate limit cache rule CR-3: bypass no cache lookup for private paths mTLS ingress check client certificate then route to app Authorize session read one billing row tenant check Response HTML for this user Set-Cookie preserved no shared copy Not stored CF-Cache-Status: DYNAMIC no Age header Cache-Control private, no-store no ETag reuse Only this user's fields no tenant leakage audit the query Rollback lever Not applicable client-side only Disable one rule or set WAF to log target: under two minutes Restore prior certificate reload nginx Flip the feature flag stop writing personal data

Auditability comes from three habits, not a dashboard. Keep the rule set in version control as Terraform or exported API JSON. Give every rule a ref, description, owner, and rollback line. Export the zone configuration before and after each change, and keep the diff with the evidence bundle. Cloudflare's audit log records purge events, including what was purged and by whom, which is the evidence you want when a "wrong page" report arrives (purge audit logs).

Name it before you need it

A rule you cannot name is a rule you cannot roll back. Every rule carries a ref, description, owner, and rollback line, and the whole set lives in version control.

Rollback for this layer is per-rule, not per-zone. Disable CR-2 to stop HTML caching, leave CR-1 in place, switch SEC-2 to log, and purge by prefix for the affected path. Purge everything is a last resort because it creates a miss storm. Test each lever on staging and write down the observed time; a rollback plan without a measured duration is a hope.

Prepare an Incident and Recovery Runbook

A runbook is a decision table with timestamps, not a wiki page. It should tell a tired person what to check first, what not to touch, and how to prove recovery. Write it for the person who did not build the system, because during an incident that person may be you.

Detection uses a small set of signals. Page on a five-minute 5xx rate above 1%, a cache hit ratio drop of more than 20 points for /assets/*, a login success rate drop of more than 30%, or an origin health-check failure. Include a synthetic canary for the marketing page, the login page, and one authenticated route. A canary that only checks the homepage will report green while checkout is down. The analytics and log pipeline in Part 45 supplies the data; the runbook needs the thresholds and the owner.

Classify before changing anything. Three questions narrow almost every incident: is the scope one hostname, one path, or the whole zone; did a change land in the last sixty minutes (the audit log answers in seconds); and does the origin answer a direct canary request? If it does, the fault is at the edge or in the path. If it does not, the fault is at the origin.

The first five minutes are scripted, and they are not a search for a fix. Acknowledge, open the incident channel, capture the current state, then choose exactly one lever. The capture list is short: the failing cf-ray, a HAR if a browser is involved, the rule set digest, the SSL mode, and the origin certificate expiry.

Never probe in production

Do not purge cache, change DNS, or disable the WAF "to see if it helps" before you know which layer failed. Each of those changes destroys evidence and widens the blast radius, and a full purge turns a wrong-body report into a miss storm.

Order the levers by blast radius. The smallest lever that fits the evidence wins:

  • Disable one rule — seconds; right when a specific rule ID is implicated.
  • Move one managed ruleset to log — under a minute; right for a suspected false positive, never as a permanent state.
  • Bypass cache for one path and purge that prefix — minutes; right for a wrong-body report.
  • Revert the TLS mode or origin certificate — minutes; expect 525 or 526 during the transition.
  • Grey-cloud a record — removes WAF, bot, cache, and DDoS absorption at once; use it only when the edge is the confirmed fault and the origin can survive direct traffic.
  • Change nameservers — an onboarding or exit action, not an incident action.

Three one-way doors

HSTS with preload is slow to undo. Once a browser stores the policy, a subdomain that still serves HTTP can be locked out. DNSSEC misconfiguration can make the zone unresolvable; disable it deliberately, never as a probe. A deleted custom rule is recoverable only if you exported it — which is the argument for keeping the rule set in version control.

Failure codes belong in the runbook. 520 is an unknown origin error, 521 a refused connection, 522 a connection timeout, 523 an unreachable origin, 524 a timeout after connection, 525 a failed TLS handshake, and 526 an invalid or untrusted origin certificate. The 525 and 526 codes point at certificates; 521 and 522 point at reachability.

Tradeoffs belong in the runbook. A WAF in block mode protects more and breaks more; log mode protects less and tells you more. A five-minute HTML TTL is fresher and produces more origin traffic. A managed challenge on login reduces abuse and conversions. Write down the chosen tradeoff and the threshold that would make you revisit it. Figure 5 turns the first ten minutes into a path with time budgets.

Incident decision path with rollback time budgets An alert for a 5xx spike leads to one question: did a change land in the last hour? If yes, the audit log identifies the change, then a rule-level or setting-level rollback is chosen. If no, a direct origin canary separates an origin fault from an edge or TLS fault. Every branch ends in verification and a recorded evidence bundle. Alert: 5xx above 1% for 5 minutes or a failed login canary Change in last 60 min? audit log, not memory Name the change and its owner rule ID or setting path Direct origin canary does the origin answer? One rule or one hostname? blast radius Disable that rule target: 2 minutes Revert the setting keep DNS proxied, target: 5 minutes Edge or TLS fault compare chain, mode, and cert expiry Origin fault fail over or restore, edge is healthy yes no yes no yes no Verify three canaries and one private route record cf-ray, status, and elapsed time Never grey-cloud first: it removes every edge control, exposes the origin, and destroys the evidence you need.

The runbook also needs a recovery-ready evidence trail: the incident start time, the failing cf-ray, the rule ID or setting changed, the time of the change, the canary result after the change, and the time the incident closed. That trail is what makes the next postmortem useful and what proves AC-7. Part 21 covers the wider incident command model, and Part 47 covers the layer-by-layer diagnosis this decision tree compresses.

Build the Controlled Website Delivery Configuration

This capstone is design-only as of 2026-11-05. No hosted zone was changed, no traffic was measured, and no product version was tested. The build below is a reproducible plan with expected observations; it becomes executed work only when someone runs it and attaches the output.

Two tracks are possible. The hosted track uses a staging hostname on a real zone and exercises the edge. The fixture track runs nginx locally with a self-signed CA and two session cookies, and exercises only the origin ingress and header behavior. The fixture cannot test WAF, bot rules, or edge cache, and it must not be described as hosted validation.

The build is ordered by reversibility, not by product menu. DNS and TLS come first because every later observation depends on them. Cache comes next because it is the easiest layer to verify with a header. Security comes last because a false positive is indistinguishable from an outage until you have a baseline. Reverse that order and you will tune WAF rules against a cache that is still warming.

Capstone build

Build the Controlled Website Delivery Configuration

Status: design-only — not executed at the 2026-11-05 verification date. Prerequisites: a domain you control, a Cloudflare account, a staging hostname, and an API token with Zone Read, DNS Edit, Zone Settings Edit, Cache Rules Edit, and WAF Edit.

  • Tools the checks below use: curl, dig, openssl, jq.
  • Free covers Full (strict), AOP, Cache Rules, Bot Fight Mode, and one rate-limit rule.
  • Pro adds Super Bot Fight Mode and a second rate-limit rule; Business adds more rules and longer windows.
  • Enterprise adds Bot Management as an add-on, API Shield, and Smart Shield Advanced.
  • Steps marked hosted-only cannot run in the local fixture.

Minimal setup. The staging origin at 203.0.113.10 serves five paths, with two test accounts:

  • /assets/app.abc123.css — the fingerprinted asset.
  • /blog/hello — anonymous blog HTML.
  • /account/billing — private HTML.
  • /login — the rate-limit target.
  • /api/v1/me — the JSON API.

For the fixture track, run nginx locally with a self-signed CA and ssl_verify_client on.

  1. Export the baseline: at least 24 hours, ideally seven days, of path metrics, DNS records, SSL mode, and rule sets. Save the JSON with the date.
  2. Proxy staging.fieldnote.example only. Leave the apex untouched until staging passes.
  3. Set SSL/TLS to Full (strict). Confirm the origin chain with openssl s_client against the staging hostname.
  4. Upload the zone-level AOP certificate, configure the origin trust store, and reload nginx. Hosted-only.
  5. Create CR-1 and CR-3. Request the asset twice and /account/billing twice. Expect MISS then HIT for the asset, and DYNAMIC or BYPASS for the account page.
  6. Create CR-2 with the cookie exclusion. Request /blog/hello with and without a session cookie. Expect a HIT without the cookie and no HIT with it.
  7. Enable cache deception armor. Request /account/billing.css and confirm no HIT.
  8. Deploy the managed ruleset in log mode. Replay a 200-URL regression list covering checkout, search, and the API. Expect zero blocks and a list of would-be actions.
  9. Add SEC-3 and SEC-6. Send six login POSTs in ten seconds from one address; expect a challenge or block on the sixth. Complete one normal login.
  10. Run the rollback drill: disable CR-2, purge /blog/ by prefix, confirm the page is DYNAMIC, re-enable, and record the elapsed time. Repeat for SEC-2 in log mode.

Expected observations are conditional, not measured.

  • CF-Cache-Status moves from MISS to HIT only on public assets.
  • Age is present on a public HIT and absent on every private response.
  • The two test accounts receive different bodies on /account/billing.
  • The sixth login POST meets a challenge, and a normal login still works.

Failure checks. A HIT on a private route, an age header on personalized HTML, a 526 after the AOP change, a WAF block on the regression list, or a rollback over five minutes.

Cost dimensions. Plan subscription, Smart Shield or Argo add-ons, Cache Reserve, Logpush export and transformation usage (all plans, usage-based, since 2026-09-30), request volume, origin egress, and staff time. No dollar figures are quoted because pricing changes.

Cleanup. Delete the test rules, revert the SSL mode, remove the AOP certificate, restore the DNS record, revoke the token, and purge the staging hostname.

Figure 6 shows the evidence flow that the card produces.

Build the Controlled Website Delivery Configuration
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart LR
    B["Baseline snapshot: 24 hours by path class"] --> S["Stage the change on one hostname"]
    S --> C["Canaries: three public, two private"]
    C --> V{"Pass criteria met?"}
    V -->|"yes"| E["Expand to apex and www"]
    V -->|"no"| R["Roll back the single lever"]
    R --> RV["Re-run canaries and confirm baseline"]
    E --> D["Record evidence bundle and config digest"]
    RV --> D
    D --> X["Sign-off: owner, date, rollback time"]
    classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
    classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
    classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
    classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
    classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
    class B,S,C,V,E,R,RV,D,X secondary;

Submit Measurements, Negative Tests, and a Rollback Demonstration

Submission is a folder, not a screenshot. A reviewer should open it and answer three questions without asking you: what changed, what proves it worked, and how long recovery takes. Use a fixed index, and let each folder answer one question.

  • 01-baseline/ — the seven-day export, with the date.
  • 02-config-before/ — the zone export taken before the first change.
  • 03-changes/ — one record per rule or setting: actor, time, reason, rollback line.
  • 04-measurements/ — before-and-after pairs by path class.
  • 05-negative-tests/ — the bypass, deception, and cross-session checks.
  • 06-rollback/ — timestamps from the timed drill.
  • 07-runbook/ — the decision table and evidence trail.
  • 08-signoff.md — owner, date, and measured rollback time.

The pass/fail matrix below is the submission's front page. Because this article is design-only, every hosted row is marked not run; the pass condition is the contract the runner must satisfy, not a claimed result.

IDEvidencePass conditionStatus
AC-1curl -I http://fieldnote.example and the HTTPS equivalent301 to HTTPS and HSTS max-age at least 15552000Not run, design-only
AC-2openssl s_client with and without the AOP client certificateConnection without the certificate is rejected; with it, the app respondsNot run, design-only
AC-3Two requests for /assets/app.abc123.cssMISS then HIT, with Age on the hitNot run, design-only
AC-4Two cookie jars, three requests each to /account/billingDifferent bodies, no HIT, no Age, cookie preservedNot run, design-only
AC-5Requests for /account/billing.css and /blog/hello.cssNo HIT on either pathNot run, design-only
AC-6Six login POSTs in ten seconds from one addressSixth is challenged or blocked; a normal login still worksNot run, design-only
AC-7Timed disable, purge, verify, re-enableRollback complete in five minutes or less, with timestampsNot run, design-only
N-1Direct request to the origin with a spoofed headerTLS handshake rejected or connection refusedNot run, design-only
N-2200-URL regression list against managed rulesZero blocks on legitimate traffic; would-be actions reviewedNot run, design-only

Score one point per row. A submission is complete at 9/9; 7–8 is conditional only when the missing rows are measurement gaps, never when isolation or rollback failed. A single HIT on a private route or an untimed rollback returns the capstone for rework regardless of the total.

Negative tests are what reviewers trust, because a happy path can happen by accident. N-1, bypass: a direct request to the origin with a spoofed client-identity header; pass means rejection. N-2, false positive: replay checkout, search, upload, and API calls with realistic bodies; pass means no block. N-3, cross-session: the two-jar test from AC-4.

N-4, deception: private HTML requested with a .css suffix and with Accept: text/css. N-5, shared NAT: burst logins from one address while a second user on that address logs in; pass means the second user is not locked out. N-6, certificate failure: point staging at an expired certificate, confirm 526, restore. N-7, rollback under load: run the drill while a canary generates traffic, because a rollback that only works on an idle zone is not a rollback.

Run the rollback demonstration as a timed exercise. At T+0 the canary fails or a rule breaks on staging. At T+1 the rule ID is identified from the change record. At T+2 the rule is disabled. At T+3 the prefix is purged. At T+4 three canaries and one private-route check run. At T+5 the cf-ray, status codes, and elapsed time are recorded. Target five minutes for a rule rollback and ten for an SSL mode revert. If DNS is required, the drill has already failed the design goal.

Self-check, with explanations:

  1. Full (strict) plus AOP means the origin is private, right? No. Global AOP uses a certificate shared across Cloudflare accounts, so it proves the request came through Cloudflare's network, not your zone. Zone-level or per-hostname AOP narrows that to your certificate, but reachability is separate; Tunnel or a network allowlist removes the public listener. AOP is also incompatible with Tunnel.
  2. A reader reports seeing another reader's name on /blog/post. First action? Bypass cache for that path and purge by prefix, then preserve the headers and failing cf-ray. Do not purge everything: a full purge creates a miss storm and destroys the evidence of which key collided. Fix the key or the eligibility expression, not the TTL.
  3. Why is greying out the record a last resort? It removes WAF, bot controls, cache, and DDoS absorption at once, exposes the origin address, and takes minutes to reverse because resolvers cache the old answer. A rule-level disable is narrower and keeps the protection you paid for.
  4. Which cache statuses count as success? HIT with Age for public assets; DYNAMIC or BYPASS for private responses. A MISS on every asset points at Set-Cookie, no-store, or a rule that never matched. BYPASS means the request was eligible but the response refused storage, a different bug from DYNAMIC.

Unresolved limitations. No hosted zone was changed and no measurement was taken, so every result is a design expectation. Availability, limits, and pricing were checked on 2026-11-05 against the planning baseline of 2026-11-02; no tool versions were tested because no lab ran. Plan-specific behavior is the largest gap: rate-limit counts, Bot Management scoring, API Shield, and Smart Shield Advanced vary by contract. WAF false-positive rates need production traffic, not a 200-URL list. The two-identity test proves isolation for those identities only, and does not cover browser caches, service workers, or origin-side proxies. Tunnel was not exercised, regional latency was not measured, and DNS propagation was not observed. Quotas and prices change; re-check them at execution time.

References, verified 2026-11-05: Cloudflare Cache, Cache Rules, Cache Rules settings, Cache responses and CF-Cache-Status, Purge cache, Cloudflare SSL/TLS, Full (strict), Authenticated Origin Pulls, Cloudflare Tunnel, Cloudflare WAF, Managed rules, Rate limiting rules, Bot Fight Mode, Super Bot Fight Mode, Smart Shield, Smart Shield get started, Logpush, and Proxy status.