Website Content Optimization
Introducing Custom Headers for Cloudflare Pages

Introducing Custom Headers for Cloudflare Pages

10/27/2021 · Nevi Shah, Greg Brimble

What this post added

Introduced native support for custom headers and enhanced redirects in Cloudflare Pages. Developers can now define headers and redirects using `_headers` and `_redirects` files, respectively. The implementation uses a matching engine modeled after the URLPattern specification, supporting splats and placeholders for flexible rule definition. This enables configuration of SEO headers (e.g., X-Robots-Tag), security headers (e.g., X-Frame-Options, Content-Security-Policy), and CORS headers (e.g., Access-Control-Allow-Origin). Redirects also support splats, placeholders, and status codes.

Read the original post ↗