How-to
Website
Web app
Deploy to Cloudflare Pages
This recipe has Cloudflare Pages build a WebFluent site on every push and serve it, with the security headers the build writes. You need a Cloudflare account and a Pages project connected to the repository; the build command installs wf as Install wf on a build machine shows. In the Pages project's build settings, set the build command:
$ curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/monzeromer-lab/WebFluent/master/install.sh | WF_VERSION=v7.1.1 bash && ~/.webfluent/bin/wf build
and set the build output directory to build.
For a single-page build, also add public/_redirects with this line:
/* /index.html 200
How it works
- The build command installs
wfand builds the site, the same command Deploy to Netlify uses. Cloudflare Pages serves thebuildfolder. - The build copies
public/_redirectsto the root ofbuild/. Its line answers every path withindex.html, so a reload on a deep link reaches the single-page build's router. - Cloudflare Pages reads
_headersand_redirectsthe same way Netlify does, so the security headers apply with no further setting.
Check it
Check the response headers in the browser's network panel, as for Netlify, and open a deep link directly. Then go through Check a deploy.