{"id":315,"date":"2025-08-26T09:00:00","date_gmt":"2025-08-26T07:00:00","guid":{"rendered":"https:\/\/mokrane-assam.com\/index.php\/2025\/08\/26\/cloudflare-gateway-policy-order-en\/"},"modified":"2025-08-26T09:00:00","modified_gmt":"2025-08-26T07:00:00","slug":"cloudflare-gateway-policy-order-en","status":"publish","type":"post","link":"https:\/\/mokrane-assam.com\/index.php\/2025\/08\/26\/cloudflare-gateway-policy-order-en\/","title":{"rendered":"Cloudflare Gateway policy order: precedence and silent breakage"},"content":{"rendered":"\n<div class=\"mkz-callout\" style=\"border-left:4px solid #38bdf8;background:#f1f5f9;padding:14px 18px;margin:0 0 18px;border-radius:6px\"><strong style=\"color:#17263f\">What you&rsquo;ll take away :<\/strong> <span style=\"color:#17263f\">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.<\/span><\/div>\n\n\n\n<figure class=\"mkz-diagram\" style=\"margin:0 auto 14px;max-width:920px\">\n<svg viewBox=\"0 0 920 194\" width=\"100%\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" font-family=\"Arial, 'Segoe UI', Helvetica, sans-serif\" role=\"img\" aria-label=\"Gateway order of enforcement between policy builders\">\n  <defs>\n    <linearGradient id=\"g59118\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n      <stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/>\n    <\/linearGradient>\n  <\/defs>\n  <rect x=\"0\" y=\"0\" width=\"920\" height=\"194\" rx=\"10\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/>\n  <path d=\"M10 0 h900 a10 10 0 0 1 10 10 v34 h-920 v-34 a10 10 0 0 1 10 -10 z\" fill=\"url(#g59118)\"\/>\n  <text x=\"18\" y=\"28\" fill=\"#ffffff\" font-size=\"17\" font-weight=\"700\">Gateway order of enforcement between policy builders<\/text>\n  <text x=\"904\" y=\"27\" fill=\"#38bdf8\" font-size=\"12\" font-weight=\"700\" letter-spacing=\"3\" text-anchor=\"end\">NET BY ME<\/text>\n  <g transform=\"translate(0,44)\">\n<rect x=\"40\" y=\"56\" width=\"180\" height=\"48\" rx=\"8\" fill=\"#eef4ff\" stroke=\"#0A66C2\" stroke-width=\"1.5\"\/><text x=\"130.0\" y=\"85.0\" font-size=\"15\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"middle\">DNS<\/text><line x1=\"220\" y1=\"80\" x2=\"254\" y2=\"80\" stroke=\"#0A66C2\" stroke-width=\"2\"\/><polygon points=\"254,80 245.0,76.0 245.0,84.0\" fill=\"#0A66C2\"\/><rect x=\"254\" y=\"56\" width=\"180\" height=\"48\" rx=\"8\" fill=\"#eef4ff\" stroke=\"#0A66C2\" stroke-width=\"1.5\"\/><text x=\"344.0\" y=\"85.0\" font-size=\"15\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"middle\">Network (L4)<\/text><line x1=\"434\" y1=\"80\" x2=\"468\" y2=\"80\" stroke=\"#0A66C2\" stroke-width=\"2\"\/><polygon points=\"468,80 459.0,76.0 459.0,84.0\" fill=\"#0A66C2\"\/><rect x=\"468\" y=\"56\" width=\"180\" height=\"48\" rx=\"8\" fill=\"#eef4ff\" stroke=\"#0A66C2\" stroke-width=\"1.5\"\/><text x=\"558.0\" y=\"85.0\" font-size=\"15\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"middle\">HTTP (L7)<\/text><text x=\"40\" y=\"36\" font-size=\"13\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"start\">Order between builders since 14 Jul 2025 (global DNS\/resolver policies first):<\/text><text x=\"40\" y=\"134\" font-size=\"12\" fill=\"#475569\" font-weight=\"400\" text-anchor=\"start\" font-style=\"italic\">Previously: DNS \u2192 HTTP \u2192 Network.  HTTP\/3 proxied traffic: DNS \u2192 Network \u2192 HTTP.<\/text>\n  <\/g>\n<\/svg>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Current state: order between builders<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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 \u2192 Network \u2192 HTTP.<\/p>\n\n\n\n<figure class=\"mkz-diagram\" style=\"margin:0 auto 14px;max-width:920px\">\n<svg viewBox=\"0 0 920 240\" width=\"100%\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" font-family=\"Arial, 'Segoe UI', Helvetica, sans-serif\" role=\"img\" aria-label=\"Precedence within a builder\">\n  <defs>\n    <linearGradient id=\"g14010\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n      <stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/>\n    <\/linearGradient>\n  <\/defs>\n  <rect x=\"0\" y=\"0\" width=\"920\" height=\"240\" rx=\"10\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/>\n  <path d=\"M10 0 h900 a10 10 0 0 1 10 10 v34 h-920 v-34 a10 10 0 0 1 10 -10 z\" fill=\"url(#g14010)\"\/>\n  <text x=\"18\" y=\"28\" fill=\"#ffffff\" font-size=\"17\" font-weight=\"700\">Precedence within a builder<\/text>\n  <text x=\"904\" y=\"27\" fill=\"#38bdf8\" font-size=\"12\" font-weight=\"700\" letter-spacing=\"3\" text-anchor=\"end\">NET BY ME<\/text>\n  <g transform=\"translate(0,44)\">\n<text x=\"24\" y=\"30\" font-size=\"13\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"start\">Inside the HTTP builder (evaluated top of list = lowest order number = highest precedence):<\/text><rect x=\"24\" y=\"48\" width=\"360\" height=\"44\" rx=\"8\" fill=\"#eef4ff\" stroke=\"#0A66C2\" stroke-width=\"1.5\"\/><text x=\"204.0\" y=\"75.0\" font-size=\"14\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"middle\">1. Do Not Inspect \/ Isolate<\/text><text x=\"400\" y=\"76\" font-size=\"13\" fill=\"#475569\" font-weight=\"400\" text-anchor=\"start\" font-style=\"italic\">always evaluated first<\/text><rect x=\"24\" y=\"104\" width=\"360\" height=\"44\" rx=\"8\" fill=\"#ffffff\" stroke=\"#17263f\" stroke-width=\"1.5\"\/><text x=\"204.0\" y=\"131.0\" font-size=\"14\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"middle\">2. Allow \/ Block by precedence<\/text><text x=\"400\" y=\"132\" font-size=\"13\" fill=\"#475569\" font-weight=\"400\" text-anchor=\"start\" font-style=\"italic\">first match wins<\/text><text x=\"24\" y=\"176\" font-size=\"12\" fill=\"#475569\" font-weight=\"400\" text-anchor=\"start\">Put specific Allow \/ Do Not Inspect above broad Block (lower order number).<\/text>\n  <\/g>\n<\/svg>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Trade-offs<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Power vs surprise<\/strong>: independent L4 and L7 layers give fine control, but a rule in one layer can cancel the visible effect of another.<\/li><li><strong>Specificity<\/strong>: you must discipline order numbers (specific before general), or a broad Block hides a precise Allow.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Failure modes (what breaks quietly)<\/h2>\n\n\n\n<figure class=\"mkz-diagram\" style=\"margin:0 auto 14px;max-width:920px\">\n<svg viewBox=\"0 0 920 224\" width=\"100%\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" font-family=\"Arial, 'Segoe UI', Helvetica, sans-serif\" role=\"img\" aria-label=\"Failure mode: block page disappears\">\n  <defs>\n    <linearGradient id=\"g76867\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n      <stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/>\n    <\/linearGradient>\n  <\/defs>\n  <rect x=\"0\" y=\"0\" width=\"920\" height=\"224\" rx=\"10\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/>\n  <path d=\"M10 0 h900 a10 10 0 0 1 10 10 v34 h-920 v-34 a10 10 0 0 1 10 -10 z\" fill=\"url(#g76867)\"\/>\n  <text x=\"18\" y=\"28\" fill=\"#ffffff\" font-size=\"17\" font-weight=\"700\">Failure mode: block page disappears<\/text>\n  <text x=\"904\" y=\"27\" fill=\"#38bdf8\" font-size=\"12\" font-weight=\"700\" letter-spacing=\"3\" text-anchor=\"end\">NET BY ME<\/text>\n  <g transform=\"translate(0,44)\">\n<rect x=\"24\" y=\"20\" width=\"420\" height=\"150\" rx=\"10\" fill=\"#fdeeee\" stroke=\"#C8102E\" stroke-width=\"1.5\"\/><text x=\"234.0\" y=\"100.0\" font-size=\"15\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"middle\"><\/text><text x=\"234\" y=\"44\" font-size=\"14\" fill=\"#C8102E\" font-weight=\"700\" text-anchor=\"middle\">The silent-block trap<\/text><text x=\"40\" y=\"72\" font-size=\"12\" fill=\"#17263f\" font-weight=\"400\" text-anchor=\"start\">HTTP Block example.com \u2192 shows block page<\/text><text x=\"40\" y=\"96\" font-size=\"12\" fill=\"#17263f\" font-weight=\"400\" text-anchor=\"start\">Network Block example.com \u2192 silent (no page)<\/text><text x=\"40\" y=\"128\" font-size=\"15\" fill=\"#C8102E\" font-weight=\"700\">&#10007;<\/text><text x=\"62\" y=\"128\" font-size=\"12\" fill=\"#17263f\" font-weight=\"400\" text-anchor=\"start\">Since Network runs first, user sees NO block page<\/text><rect x=\"476\" y=\"20\" width=\"420\" height=\"150\" rx=\"10\" fill=\"#eaf5ee\" stroke=\"#166534\" stroke-width=\"1.5\"\/><text x=\"686.0\" y=\"100.0\" font-size=\"15\" fill=\"#17263f\" font-weight=\"600\" text-anchor=\"middle\"><\/text><text x=\"686\" y=\"44\" font-size=\"14\" fill=\"#166534\" font-weight=\"700\" text-anchor=\"middle\">Fixes<\/text><text x=\"490\" y=\"76\" font-size=\"15\" fill=\"#166534\" font-weight=\"700\">&#10003;<\/text><text x=\"512\" y=\"76\" font-size=\"12\" fill=\"#17263f\" font-weight=\"400\" text-anchor=\"start\">Add a client notification to the Network policy<\/text><text x=\"490\" y=\"104\" font-size=\"15\" fill=\"#166534\" font-weight=\"700\">&#10003;<\/text><text x=\"512\" y=\"104\" font-size=\"12\" fill=\"#17263f\" font-weight=\"400\" text-anchor=\"start\">Or block that domain only in HTTP<\/text><text x=\"490\" y=\"132\" font-size=\"15\" fill=\"#166534\" font-weight=\"700\">&#10003;<\/text><text x=\"512\" y=\"132\" font-size=\"12\" fill=\"#17263f\" font-weight=\"400\" text-anchor=\"start\">Verify which builder caught it in Gateway logs<\/text>\n  <\/g>\n<\/svg>\n<\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Vanishing block page<\/strong>: since July 2025 a silent Network block applies before an HTTP block-with-page \u2014 the user no longer sees the page and assumes an outage.<\/li><li><strong>Broad Block above a specific Allow<\/strong>: order numbers inverted, and the exception never applies.<\/li><li><strong>Forgetting Do Not Inspect<\/strong>: to exempt a site from TLS inspection you need a Do Not Inspect policy \u2014 a plain Allow is not enough.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Proving the negative<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Reproduce with a test domain and read Gateway logs: which builder decided?<\/li><li>Verify a specific exception has a lower order number than the general Block.<\/li><li>Confirm a Network block meant to be visible carries a client notification.<\/li><li>Drive precedence via Terraform (<code>precedence<\/code> field, lower = higher priority).<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Takeaway<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Most Gateway \u201cbugs\u201d are ordering problems, not rule problems. Remember the DNS \u2192 Network \u2192 HTTP chain, first-match-wins, and always place the specific before the general.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:28px;padding-top:14px;border-top:1px solid #e2e8f0;color:#17263f\"><em>A question or some feedback? Reach me on LinkedIn: Mokrane Assam.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What you&rsquo;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<\/p><\/div>\n<div class=\"blog-btn\"><a href=\"https:\/\/mokrane-assam.com\/index.php\/2025\/08\/26\/cloudflare-gateway-policy-order-en\/\" class=\"home-blog-btn\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[16,10],"class_list":["post-315","post","type-post","status-publish","format-standard","hentry","category-networking-security","tag-cloudflare-one","tag-zero-trust"],"_links":{"self":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts\/315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/comments?post=315"}],"version-history":[{"count":0,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts\/315\/revisions"}],"wp:attachment":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/media?parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/categories?post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/tags?post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}