Page Rules & Edge Forwarding
Page RulesConfigure URL forwarding, edge redirect rules, cache overrides, and custom HTTP header handling.
📖 Full Explanation
Page Rules allow fine-grained URL pattern matching to execute actions directly at the edge, such as canonical 301 redirects from \1 to non-www, enforcing aggressive caching for image assets, or bypassing cache for dynamic API endpoints.
⚙️ Command Options & Flags
| Option / Flag | Description | Default |
|---|---|---|
| -u, --url <pattern> | URL pattern (e.g. www.example.com/*) | required for create |
| -a, --action <action> | Rule action: forward_url, cache_level, always_online | forward_url |
| -s, --status-code <code> | HTTP redirect status code (301, 302) | 301 |
| -t, --target <url> | Forwarding destination URL | - |
🔬 Technical Corollary & Edge Mechanics
Calls \1. Page Rules evaluate in priority order from top to bottom, with the first matching pattern taking precedence.
🎯 Real-World DevOps Use Cases
Apex to WWW Canonical 301 Redirect
Redirect all \1 requests to \1 at the edge.
Bypassing Cache for API Routes
Ensure that edge proxies never store responses from \1.
💻 Live Output Simulation
$ cflare pagerules list namishkumar.in ┌────┬──────────────────────────────────┬─────────────────────────────┬────────┐ │ # │ URL Pattern │ Action │ Status │ ├────┼──────────────────────────────────┼─────────────────────────────┼────────┤ │ 1 │ http://namishkumar.in/* │ Forward URL (301 to https) │ active │ │ 2 │ namishkumar.in/static/* │ Cache Everything (TTL: 7d) │ active │ └────┴──────────────────────────────────┴─────────────────────────────┴────────┘