pi-cloudflare 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cloudflare",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "Cloudflare Agent Plugin and native Pi extension providing official skills and cf_-prefixed MCP tools.",
5
5
  "keywords": [
6
6
  "agent-plugin",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "pi-cloudflare",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "description": "Cloudflare skills and cf_-prefixed MCP tools, with a native Pi adapter and an Agent Plugins 1.0 portable runtime.",
6
6
  "author": {
7
7
  "name": "0xPlayerOne",
@@ -191,6 +191,73 @@ Do not read a non-`403` on a URI payload as a broken deployment.
191
191
  Read the ruleset with `GET /zones/:zone_id/rulesets/:ruleset_id` to inspect the
192
192
  signature list on the user's plan.
193
193
 
194
+ ## Asset caching
195
+
196
+ Check what the origin actually sends before writing a rule. Most build tools
197
+ already emit the right header for content-hashed files, and a rule that re-sets
198
+ the same header can produce a **duplicated value** rather than a fix:
199
+
200
+ ```
201
+ cache-control: public, max-age=31536000, immutable, public, max-age=31536000, immutable
202
+ ```
203
+
204
+ That duplication means two layers set it (app plus platform). A transform rule
205
+ using `set` collapses it to one value. Prefer that over `add`, which would append
206
+ a third.
207
+
208
+ Normalise these three shapes, and verify each with a live request:
209
+
210
+ | Response | Target |
211
+ | --- | --- |
212
+ | Hashed asset (`/assets/index-<hash>.js`, `/_astro/*.<hash>.css`) | `public, max-age=31536000, immutable` |
213
+ | HTML | `public, max-age=0, must-revalidate` |
214
+ | Mutable metadata JSON | revalidate, or a short TTL |
215
+
216
+ Scope a header rule by **hostname** when a zone serves several apps
217
+ (`http.host eq "app.example.com"`), not with `expression: "true"`. A zone-wide
218
+ `set` silently overrides the per-app headers of every other host in that zone.
219
+
220
+ ### R2 custom domains are not edge-cached
221
+
222
+ Objects served from an R2 public bucket on a custom domain answer
223
+ `cf-cache-status: DYNAMIC` and **never become `HIT`**, even with an enabled Cache
224
+ Rule that matches the host and path, and even after switching the rule's
225
+ `edge_ttl` from `respect_origin` to an explicit `override_origin`. Zone cache
226
+ rules do not apply to R2 custom-domain traffic.
227
+
228
+ R2 serves from its own edge, so this is not slow, but it does mean a Cache Rule
229
+ cannot be used to tune it. Caching those objects at the zone edge requires a
230
+ Worker in front of the bucket (Cache API, or `cf: { cacheEverything: true }`).
231
+ Do not promise a cache-rule fix here; check what the user actually needs first.
232
+
233
+ ## Rate-limit vs WAF custom rules (rule budgets)
234
+
235
+ The Free plan allows **one** rule in the `http_ratelimit` phase, while
236
+ `http_request_firewall_custom` allows several. The dashboard's Leaked Credentials
237
+ template lands in the rate-limit phase, so on a zone where that single slot is
238
+ already spent the add fails with:
239
+
240
+ ```
241
+ 50001 exceeded the maximum number of rules in the phase http_ratelimit: 2 out of 1
242
+ ```
243
+
244
+ The same check works in the custom phase, which frees the rate-limit slot:
245
+
246
+ ```jsonc
247
+ PUT /zones/:zone_id/rulesets/phases/http_request_firewall_custom/entrypoint
248
+ {
249
+ "rules": [{
250
+ "action": "block",
251
+ "description": "Leaked credential check",
252
+ "enabled": true,
253
+ "expression": "(cf.waf.credential_check.password_leaked)"
254
+ }]
255
+ }
256
+ ```
257
+
258
+ Match the shape the estate already uses before adding a new one — if some zones
259
+ run it in the rate-limit phase, copy the shape rather than inventing a variant.
260
+
194
261
  ## Response header transform rules
195
262
 
196
263
  Preserve any rules already in the phase — read the entrypoint first, then PUT the