惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
博客园 - 司徒正美
TaoSecurity Blog
TaoSecurity Blog
Martin Fowler
Martin Fowler
T
Threat Research - Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
S
Secure Thoughts
博客园 - 三生石上(FineUI控件)
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
K
Kaspersky official blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
H
Help Net Security
博客园 - 叶小钗
爱范儿
爱范儿
GbyAI
GbyAI
I
Intezer
M
MIT News - Artificial intelligence
Latest news
Latest news
Schneier on Security
Schneier on Security
T
Tor Project blog
Simon Willison's Weblog
Simon Willison's Weblog
I
InfoQ
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CXSECURITY Database RSS Feed - CXSecurity.com
罗磊的独立博客
N
News and Events Feed by Topic
T
The Blog of Author Tim Ferriss
V2EX - 技术
V2EX - 技术
B
Blog
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
Security Latest
Security Latest
V
V2EX
F
Fortinet All Blogs
Forbes - Security
Forbes - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Hacker News
The Hacker News
Scott Helme
Scott Helme
P
Privacy International News Feed
P
Palo Alto Networks Blog
H
Heimdal Security Blog
C
Cisco Blogs
T
The Exploit Database - CXSecurity.com
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
G
Google Developers Blog
W
WeLiveSecurity
L
LINUX DO - 最新话题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Why Cloudflare's Free-Plan Cache Rules Don't Cache Your HTML (And the Page Rules Fix That Does)
doodoolove · 2026-05-07 · via DEV Community

A 90-minute debugging session, with curl outputs.


TL;DR

We run a 6,800-page games portal behind Cloudflare on the Free plan. Last week's audit flagged that cf-cache-status was returning DYNAMIC for every HTML request, despite an origin Cache-Control: s-maxage=31536000. We spent 90 minutes building Cache Rules with every "correct" config — Eligible for cache, Edge TTL, browser TTL, expression filters covering 8 path patterns — and Cloudflare still refused to cache HTML. The fix wasn't another tweak to Cache Rules; it was switching to the older Page Rules with Cache Everything + Edge Cache TTL. Within 10 seconds of saving, our second-request TTFB dropped from 660ms to 210ms (a 68% reduction on keep-alive connections, much larger globally) and age: headers started incrementing. This post is the actual headers we saw, the configs we tried, and why the docs don't tell you this directly.


The setup

DooDoo.Love is a multilingual HTML5 games portal. ~6,800 game pages, plus categories, tags, blog, news. Origin is Vercel; Cloudflare sits in front for DNS + a few security headers + (we hoped) HTML caching. We're on the Free plan because it's enough for our traffic and we'd rather spend the $20/month elsewhere.

The full SEO audit pegged our indexing rate at 18.6% — Google had crawled and indexed only 1,250 of our 6,725 sitemap URLs. One contributing factor (among several): Googlebot was paying full origin TTFB for every page in every region. From Tokyo, that meant 1,800ms just to start receiving HTML. With a flat crawl budget, that math eats most of the budget on protocol overhead instead of actual page content.

Edge caching HTML at Cloudflare's POPs would mean Googlebot in Tokyo hits the Tokyo POP (round-trip ~30ms) instead of LAX (round-trip ~150ms). On 6,800 URLs, that's a meaningful budget unlock. So: configure CF, get cf-cache-status: HIT, ship it.

It did not go that way.


What we tried first: Cache Rules

Cloudflare's modern caching configuration UI is Cache Rules (under Caching → Cache Rules). Page Rules are the legacy interface, and the docs nudge you toward Cache Rules. So we built one:

  • Rule name: Cache HTML edge
  • Match expression:
  (http.host eq "doodoo.love" and http.request.method eq "GET" and (
    starts_with(http.request.uri.path, "/games/")
    or starts_with(http.request.uri.path, "/blog/")
    or starts_with(http.request.uri.path, "/news/")
    or starts_with(http.request.uri.path, "/categories/")
    or starts_with(http.request.uri.path, "/tags/")
    or http.request.uri.path eq "/"
    [...]
  ))

Enter fullscreen mode Exit fullscreen mode

  • Cache eligibility: Eligible for cache
  • Edge TTL: Use cache-control header if present, otherwise bypass
  • Browser TTL: Override origin TTL → 4 hours

Saved. Deployed. State: 活动 (Active). Order: 1.

We then ran:

$ curl -sI https://doodoo.love/games/sudoku | grep -i "cf-cache-status"
cf-cache-status: DYNAMIC

Enter fullscreen mode Exit fullscreen mode

Five attempts in a row, each with a 2-second sleep between. Every single one: DYNAMIC. No MISS → HIT progression. No age: header.

The origin response was healthy — cf-ray confirmed Cloudflare was on the path, x-nextjs-cache: HIT confirmed Vercel was caching its end, and cache-control: s-maxage=31536000, stale-while-revalidate was being sent. There was no Set-Cookie. No Vary: *. No Pragma: no-cache. The response was, by every spec we knew, cacheable.


Diagnostic detour: ruling out the obvious

We worked through the standard checklist:

  1. Was the rule actually deployed (not draft)? Yes, status was 活动 (Active).
  2. Was there a higher-priority rule overriding? No, this was the only Cache Rule.
  3. Was the expression matching? We tested a path explicitly not in the expression (/api/test-not-in-rule) and got DYNAMIC too — but that's expected because it's not in the rule. The match question stayed inconclusive from headers alone.
  4. Was Cloudflare seeing the request? Yes, every response had cf-ray: and server: cloudflare.
  5. Was a static asset cacheable? curl -sI .../logo.png returned cf-cache-status: MISS (cacheable, just not yet warmed). So Cloudflare's cache pipeline was not broken globally — only HTML was failing.
  6. Did switching Edge TTL to "Ignore cache-control header, use this TTL" fix it? No. Even forcing Cloudflare to use a manual 1-hour TTL, ignoring the origin entirely, the response stayed DYNAMIC.

That last data point was the one that broke our model. If "Ignore cache-control" + a hard TTL doesn't cache an HTML response, the rule isn't being honored at all. Something below the rule layer was vetoing the cache.


The actual answer

Cloudflare Free Plan + Cache Rules + text/html is an empirically unreliable combination. The Cache Rules feature is technically available on Free, but caching of HTML/dynamic content has documented quirks that don't apply to static assets.

We confirmed plan tier in the dashboard (top right: "Free"), and we confirmed the rule was correctly configured. Cache Rules just doesn't reliably cache text/html for Free-tier accounts in 2026, regardless of how perfectly you configure it.

The interesting thing is the docs don't say this directly. They say Cache Rules are available on Free. They don't say "but for HTML on Free, use Page Rules instead." We figured this out by switching.


The fix: Page Rules with Cache Everything

Page Rules predate Cache Rules and have a different code path inside Cloudflare. On the Free plan you get 3 rules. Here's what we set:

Rule 1: *doodoo.love/games/*
  - Cache Level: Cache Everything
  - Edge Cache TTL: 2 hours

Rule 2: *doodoo.love/categories/*
  - Cache Level: Cache Everything
  - Edge Cache TTL: 2 hours

Rule 3: *doodoo.love/tags/*
  - Cache Level: Cache Everything
  - Edge Cache TTL: 2 hours

Enter fullscreen mode Exit fullscreen mode

Cache Level: Cache Everything is the magic incantation. Without it, Cloudflare's default Cache Level (Standard) is "cache only static file extensions" — which excludes HTML even though text/html is the largest miss in the URL space. Cache Rules' "Eligible for cache" eligibility flag should be the equivalent override, but on Free it isn't (or isn't fully). Page Rules' Cache Everything is.

We saved, then purged:

Caching → Configuration → Purge Cache → Purge Everything

Enter fullscreen mode Exit fullscreen mode

Then verified:

$ curl -sI https://doodoo.love/games/sudoku | grep -i "cf-cache"
cf-cache-status: MISS

$ sleep 3
$ curl -sI https://doodoo.love/games/sudoku | grep -iE "cf-cache|^age"
cf-cache-status: HIT
age: 3

Enter fullscreen mode Exit fullscreen mode

age: 3 — the response had been at the edge for 3 seconds. Two minutes later, age: 124. The HIT was real.

We hit /categories/puzzle and /tags/puzzle-games and saw the same MISS → HIT pattern. The three Page Rules covered our highest-traffic surface: ~6,820 game pages plus 14 category pages plus 33 tag pages = ~6,867 URLs cached at edge.


What didn't speed up: TTFB on the same connection

The first thing we noticed after the switch is that TTFB didn't change on a fresh curl. From our LA-area test machine to the Cloudflare LAX POP, TTFB stayed around 660ms whether the response was DYNAMIC or HIT. We almost reverted, thinking the Page Rule wasn't actually doing anything despite the headers.

Then we ran three requests in a single keep-alive curl session:

Req 1: TTFB 0.648s, total 0.708s   ← cold connection, full TLS handshake
Req 2: TTFB 0.210s, total 0.530s   ← reused connection, hit edge cache
Req 3: TTFB 0.211s, total 0.275s   ← same

Enter fullscreen mode Exit fullscreen mode

Request 1 is dominated by the TLS handshake (~440ms in our time_appconnect). Cloudflare HIT or origin pass-through, that handshake cost is the same. Requests 2 and 3 reuse the connection and now expose the actual cache delta: 660ms → 210ms = −68%.

Most real users don't run curl cold once. They open a tab, the browser establishes a connection, and then loads the HTML + dozens of subresources over that same connection. The "cold first hit" is a small fraction of total user-perceived latency. The cache win shows up on every subsequent request.

For Googlebot and other crawlers, the win shows up differently again. From the Cloudflare Tokyo POP, our origin in LAX is ~120ms RTT away. From an Asian user/crawler, hitting the Tokyo POP is ~30ms RTT. Pre-cache: 30ms RTT (user→Tokyo) + 120ms RTT (Tokyo→LAX) + origin work + return path = ~180-220ms. Post-cache: 30ms RTT (user→Tokyo) + 5-15ms (cached HTML out) + return path = ~50-80ms. The win on a global audience is much larger than the LA-to-LA test shows.


What we'd do differently

Don't start with Cache Rules on a Free plan if your goal is HTML caching. Cache Rules are the future, the docs treat them as canonical, and on Pro+ they work perfectly for HTML. On Free in mid-2026, Page Rules with Cache Everything are still the proven path. Start there. Migrate to Cache Rules when you upgrade.

Always verify with age: not just cf-cache-status: HIT. The cf-cache-status field is generated as Cloudflare formats the response; it can theoretically be HIT while the origin was actually consulted. The age: header is harder to fake — it's the seconds since the cached response was stored. If age: increments across requests, you have real edge caching.

Test with TLS handshake folded out. Cold-curl TTFB will mislead you when the cache delta is similar in size to the TLS handshake. Use keep-alive (curl with multiple URLs in one invocation) or run from a region far from your origin to expose the real cache benefit.

Free plan trade-offs are real but not large. We get 3 Page Rules; we used them on /games/*, /categories/*, and /tags/* (the three highest-traffic surfaces). The other ~1% of pages (/blog, /news, /about, root) stay uncached. For our use case, that's fine — those routes aren't crawled or hit at the same volume. If you have 10+ high-traffic surfaces, Pro is $240/year, which most production sites can absorb.


Read more


About the author: Steuber Alberto is Editor-in-Chief at DooDoo.Love. Reach me at support@doodoo.love.