Cloudflare Gateway policy order: precedence and silent breakage

Cloudflare Gateway policy order: precedence and silent breakage

What you’ll take away : Gateway applies your policies in a precise order between builders (DNS, then Network, then HTTP since July 2025) and by precedence inside each builder (first match wins, lower number = higher priority). Understanding this order avoids the classic trap: a rule that blocks where you did not expect it.
Gateway order of enforcement between policy builders NET BY ME DNSNetwork (L4)HTTP (L7)Order between builders since 14 Jul 2025 (global DNS/resolver policies first):Previously: DNS → HTTP → Network. HTTP/3 proxied traffic: DNS → Network → HTTP.

Current state: order between builders

Gateway evaluates DNS policies first (global DNS/resolver policies before everything), then Network (L4), then HTTP (L7). This order changed on 14 July 2025: HTTP used to run before Network. For proxied HTTP/3 traffic the order is also DNS → Network → HTTP.

Precedence within a builder NET BY ME Inside the HTTP builder (evaluated top of list = lowest order number = highest precedence):1. Do Not Inspect / Isolatealways evaluated first2. Allow / Block by precedencefirst match winsPut specific Allow / Do Not Inspect above broad Block (lower order number).

Inside a builder, precedence decides: the first matching policy wins, and a lower order number is evaluated earlier. For HTTP, Do Not Inspect and Isolate policies are always evaluated before Allow/Block.

Trade-offs

  • Power vs surprise: independent L4 and L7 layers give fine control, but a rule in one layer can cancel the visible effect of another.
  • Specificity: you must discipline order numbers (specific before general), or a broad Block hides a precise Allow.

Failure modes (what breaks quietly)

Failure mode: block page disappears NET BY ME The silent-block trapHTTP Block example.com → shows block pageNetwork Block example.com → silent (no page)✗Since Network runs first, user sees NO block pageFixes✓Add a client notification to the Network policy✓Or block that domain only in HTTP✓Verify which builder caught it in Gateway logs
  • Vanishing block page: since July 2025 a silent Network block applies before an HTTP block-with-page — the user no longer sees the page and assumes an outage.
  • Broad Block above a specific Allow: order numbers inverted, and the exception never applies.
  • Forgetting Do Not Inspect: to exempt a site from TLS inspection you need a Do Not Inspect policy — a plain Allow is not enough.

Proving the negative

  • Reproduce with a test domain and read Gateway logs: which builder decided?
  • Verify a specific exception has a lower order number than the general Block.
  • Confirm a Network block meant to be visible carries a client notification.
  • Drive precedence via Terraform (precedence field, lower = higher priority).

Takeaway

Most Gateway “bugs” are ordering problems, not rule problems. Remember the DNS → Network → HTTP chain, first-match-wins, and always place the specific before the general.

A question or some feedback? Reach me on LinkedIn: Mokrane Assam.

Mokrane ASSAM

Comments are closed.

Proudly powered by WordPress | Theme: SpicePress by SpiceThemes