/ blog/cloudflare-page-rules-bandwidth
blog / cloudflare-page-rules-bandwidth / overview.md

3 Cloudflare Page Rules to Halve Your Bandwidth Costs

Stop serving static assets from your origin server. Cache aggressively at the edge.

Bandwidth is expensive. If you are serving images, fonts, or JS bundles from your origin server, you are throwing money away.

Set up these Cloudflare Page Rules:

  1. Cache Everything on static routes

    • URL Match: *yourdomain.com/_next/static/*
    • Setting: Cache Level -> Cache Everything, Edge Cache TTL -> 1 month.
  2. Bypass Cache on API routes

    • URL Match: *yourdomain.com/api/*
    • Setting: Cache Level -> Bypass
  3. Browser Cache TTL for Images

    • URL Match: *yourdomain.com/images/*
    • Setting: Browser Cache TTL -> a year

By default, Cloudflare respects origin headers. Forcing "Cache Everything" ensures requests never hit your server.

Tags

devopsperformance
0
0