← knowledge.oriz.in

URL shortener quota mitigation — cache the 301 itself at the CF edge

decision short-linkcloudflareworkerquotacachingmitigation

URL shortener quota mitigation — cache the 301 itself at the CF edge

Decision

The family's s.oriz.in shortener is a Cloudflare Worker. The free tier is 100,000 Worker requests/day per script. The user asked: "Is in there any completely free service ... I will overpower the overrun the cloud player workers limit if I use this. How to mitigate?"

The mitigation is a single trick: cache the 301 redirect itself at the Cloudflare edge.

// sketch — actual Worker is ~30 LoC
return new Response(null, {
  status: 301,
  headers: {
    Location: target,
    'Cache-Control': 'public, max-age=31536000, immutable',
    'CDN-Cache-Control': 'public, max-age=31536000, immutable',
  },
});

With this header set:

No external shortener is added. No card. No Bitly. No paid tier.

Why this works

Realistic upper bound at family scale

Back-of-envelope:

Add a 2× safety margin for cold-cache spread across CF's ~300+ edge POPs (each POP misses cache once per slug per year): worst case ~1-2K Worker requests/day. The free tier is 100,000/day. We sit at 1-2% of headroom, comfortably inside rules/interaction/never-hit-quotas.md.

Implications

Cross-refs