A security review of a shop behind Cloudflare finds /account/orders/receipt.css returns a customer's order page; what does Cache Deception Armor stop here, and what else must change?
answer
- a static-looking URL over a dynamic page
- extension against Content-Type
- a Cache Key setting in a rule
- overrides can defeat it
- fix the origin's routing too
basics
~20 sCache Deception Armor, a Cache Key setting in a Cache Rule, skips caching when the Content-Type does not match the URL's extension, so the HTML behind .css is not stored. Overrides can defeat it: also bypass account paths and return 404 there.
solid answer
~50 sThe origin serves `/account/orders` for any deeper path, and `.css` is a default cached extension, so a signed-in customer lured to that URL can have their order page stored and served to the next requester. **Cache Deception Armor** (`cache_key.cache_deception_armor`), available on every plan inside a Cache Rule set to Eligible for cache, checks that the extension matches the returned `Content-Type`: `.css` with `text/html` is a mismatch, so Cloudflare does not cache it. It allows `application/octet-stream` and benign pairs such as `.jpg` served as `image/webp`. It depends on Origin Cache Control, and an origin `Cache-Control` header or an Edge TTL Cache Rule may override it, and it never catches personal data whose type matches its extension. So scope the armour rule to static extensions, add a later **Bypass cache** rule for account paths and the session cookie, fix the origin to return 404 for unknown sub-paths, and purge what was stored.
go deeper
Recall that Cache Deception Armor refuses to cache a response whose Content-Type does not match the URL's extension.
Explain where the setting lives, its octet-stream and image exceptions, and why it needs a Cache Rule set to Eligible for cache.
Show the layered fix: armour scoped to static extensions, a later bypass for personal paths, no Edge TTL overrides there, an origin 404, and a purge.
Treat deception as a policy gap: who checks that origin routing and cache rules agree, and how a review catches the next mismatch.
## The weakness the review found This is **web cache deception**, and the defender needs only enough of it to recognise it. The origin's routing treats `/account/orders/receipt.css` like `/account/orders` and returns the signed-in customer's HTML order page. `.css` is on Cloudflare's default cached-extension list, so even with **no Cache Rule at all** Cloudflare treats the request as cacheable. If the origin's response carries no `private`, `no-store` or `Set-Cookie`, the page is stored, and the next person to request that exact URL from the same data center receives the customer's orders. Someone only has to get a signed-in customer to open the link. In access logs it shows up as static-looking URLs under personal routes that return `text/html`, which is also how a review finds it. ## What Cache Deception Armor checks **Cache Deception Armor** is a **Cache Key** setting inside a Cache Rule set to **Eligible for cache** (`cache_key.cache_deception_armor` in the API), and it is available on every plan. It keeps static assets cacheable but verifies that the URL's **extension matches the returned `Content-Type`**. When they disagree in a way that could be an attack, Cloudflare does not cache the response. In the review's case, `.css` should come back as `text/css`; the origin returns `text/html`, so the receipt page is not stored. Exceptions keep normal sites working: - If the response is `application/octet-stream`, the extension does not matter, because that type tells the browser to save the file rather than display it. - Pairings that are unlikely to be attacks are allowed, such as `.jpg` served as `image/webp` or `.gif` served as `video/webm`. ## Where the armour stops protecting - **Overrides.** Cache Deception Armor depends on Origin Cache Control: a `Cache-Control` header from the origin, or an Edge TTL Cache Rule, **may override** the protection. A rule with an `override_origin` Edge TTL that reaches account paths undoes much of its value. - **Matching types.** It looks only at extension against type. A personal endpoint such as `/api/me.json` that returns `application/json` is not a mismatch and is not caught. - **Scope.** It acts only on requests matched by the rule that carries it. Because that rule is set to Eligible for cache, giving it a hostname-wide expression would also make every HTML page on the hostname a cache candidate. Scope it to static extensions instead. | Control | What it stops | What it leaves | |---|---|---| | Cache Deception Armor in the static rule | Caching an extension and type mismatch | Personal data with a matching type; cases an override defeats | | A later Bypass cache rule on account paths and the session cookie | Any caching of those requests, decided before the cache lookup | Paths nobody listed | | Origin returns 404 for unknown sub-paths | The deceptive URL itself | Needs an application change | | Origin sends `private` or `no-store` on personal pages | Storage under respect-origin modes | Ignored by an `override_origin` Edge TTL | ## Rolling out the fix 1. Turn on **Cache deception armor** in a Cache Rule whose expression covers the static extensions, for example `http.request.uri.path.extension in {"css" "js" "png" "jpg" "webp"}`, with Edge TTL left on `respect_origin`. 2. Add, or extend, a **Bypass cache** rule placed after it for `/account`, `/checkout` and requests carrying the session cookie; the last matching rule wins, so the bypass holds even for `.css` paths under `/account`. 3. Remove any `override_origin` Edge TTL from rules that can match personal paths. 4. Fix the origin so unknown sub-paths under personal routes return 404, and send `Cache-Control: private` on personal pages. 5. Purge the URLs the review reproduced, since copies stored before the fix stay until they expire. 6. Re-test: request the deceptive URL signed in, then again from a clean client; the second response must not contain the customer's page, and it must not come from cache. ## Why each layer matters - The armour is a cheap guard that works on every plan with no application change. - The bypass rule protects even when the origin's types or headers are wrong. - The origin fix removes the deceptive URL instead of relying on the edge to notice it. - The review's reproduction becomes a regression check, run again after every change to the zone's Cache Rules.
- Does Cache Deception Armor protect a Cloudflare zone that has no Cache Rules at all?No. It is a Cache Key setting inside a Cache Rule, so it applies only to requests that a rule carrying it matches. A zone without rules still caches default extensions such as `.css` and `.jpg`, so a deceptive path there is cacheable unless the origin marks the response `private` or `no-store`. Add a rule scoped to static extensions with the armour turned on.
- Why is a personal endpoint like /api/me.json not covered by Cache Deception Armor?The armour refuses to cache only when the extension and the `Content-Type` disagree. `/api/me.json` returns `application/json`, which matches `.json`, so nothing looks wrong. Keep such endpoints out of cache with a Bypass cache rule on the API path and `Cache-Control: private` or `no-store` from the origin.
- Cache Deception Armor blocks any request whose path ends in a static extension.
- Cache Deception Armor is guaranteed to hold even under an override_origin Edge TTL.
- Turning on Cache Deception Armor requires an Enterprise plan.
- Cache Deception Armor works by checking whether the request carries a session cookie.
- Enabling the armour in a rule that matches the whole hostname changes nothing about which HTML is cached.
Assumes Cloudflare as of 2026-10-10: Cache Deception Armor is switched on in a Cache Rule's Cache Key settings, now that Page Rules, which also carried it, are deprecated.