Cloudflare Configuration
Managing _headers and _redirects via the MD-Clean Protocol.
PRID: 1701
VERIFIED
1 min read
Cloudflare Pages Deployment Configuration
We use the MD-Clean Protocol to ensure all configuration files are visible and easy to manage in development environments.
1. Naming Convention
- In Development/Source: Files are named
headers.mdandredirects.md(insidepublic/). - In Production (Renamed via CI): The GitHub Action renames these to
_headersand_redirectsby removing the.mdand adding the_prefix.
2. Source Templates
public/redirects.md (Source Name)
Ensures SPA routing works on the Cloudflare edge.
text/* /index.html 200
public/headers.md (Source Name)
Implements security and caching policies.
text/* X-Frame-Options: DENY X-Content-Type-Options: nosniff Referrer-Policy: strict-origin-when-cross-origin Strict-Transport-Security: max-age=31536000; includeSubDomains; preload /assets/* Cache-Control: public, max-age=31536000, immutable
3. Transformation Script
This logic is integrated into github/workflows/ci-suite.yml:
bash[ -f public/headers.md ] && mv public/headers.md public/_headers [ -f public/redirects.md ] && mv public/redirects.md public/_redirects