Cloudflare Pages puts a static website (HTML, CSS, JavaScript, images) on Cloudflare's network for free: you upload a folder, and visitors get it from a data centre near them, with HTTPS. This guide takes a small documentation site from a folder on a laptop to production: the first upload, deploys from the terminal, security headers, previews that only your team can open, your own domain, a rollback, and deploys from CI with a key that can do nothing but publish this one kind of project.
Tested on 18 and 26 November 2026 on a free Cloudflare account (NexaForge, our test account), with Wrangler 4.164.0 and Node.js 26.13.1 on Ubuntu 26.04.1. Every command below ran there, and every screenshot shows its real output.
Quick answer: Cloudflare Pages for production
In plain words: a Pages project is a folder of files with an address, <name>.pages.dev. Each upload is a new deployment with its own address; one of them is "production". You can upload from the dashboard or from the terminal with Wrangler, Cloudflare's command-line tool. Two small text files in the folder, _headers and _redirects, control headers and redirects without any server.
- Put the built site in one folder, with
_headers,_redirectsand a404.html. - Create the project by drag and drop in the dashboard (the first upload).
- Install Wrangler in the project and deploy with
npx wrangler pages deploy. - Deploy a branch name to get a preview address, and restrict previews with Cloudflare Access.
- Add your own domain; keep the
pages.devaddress out of search results withnoindex. - Know where the rollback button is before you need it.
- For CI, create an account API token that can only edit Pages, with an expiry date.
- Keep every file under 25 MiB and the site under 20,000 files on the free plan.

Is Cloudflare Pages free? Limits and pricing in 2026
Yes. On every plan, requests for static files are free and unlimited: Cloudflare does not charge Pages sites per visit. What the plans change is how much you can build and attach. These are Cloudflare's published limits (checked 26 November 2026):
| Free | Pro | Business | |
|---|---|---|---|
| Static requests | Free, unlimited | Free, unlimited | Free, unlimited |
| Builds per month (Git projects) | 500 | 5,000 | 20,000 |
| Builds at the same time | 1 | 5 | 20 |
| Files per site | 20,000 | 100,000 | 100,000 |
| Largest single file | 25 MiB | 25 MiB | 25 MiB |
| Custom domains per project | 100 | 250 | 500 |
| Projects per account | 100 | 100 | 100 |
| Preview deployments | Unlimited | Unlimited | Unlimited |
Two things can cost money. Pages Functions (server code inside a Pages project) count as Workers requests: 100,000 a day on the free plan, then the Workers Paid plan, from $5 a month with 10 million requests included. And on paid plans, the 100,000-file limit needs the variable PAGES_WRANGLER_MAJOR_VERSION=4 in the project settings. A plain static site, like the one in this guide, uses neither and stays at $0.
Pages or Workers static assets?
A Cloudflare Worker can serve static files too (Workers static assets), and the dashboard now leads with Workers: when you create an app, Pages sits behind a small link that calls it "the legacy Pages workflow". Pages still works, and Cloudflare publishes a guide for moving a Pages project to Workers. We uploaded the same folder both ways and checked the results:

| Pages (Direct Upload) | Workers static assets | |
|---|---|---|
| Address | <project>.pages.dev | <worker>.<subdomain>.workers.dev |
| Price for static files | Free, unlimited | Free, unlimited |
_headers and _redirects | Yes (tested) | Yes (tested) |
/page.html to /page | 308 (permanent) | 307 (temporary, by default) |
| Preview of a branch | --branch=staging gives staging.<project>.pages.dev | Preview URLs, on by default when workers.dev is on |
| Restrict previews with Access | One button in the project settings (tested) | Not tested here |
| Rollback | Dashboard button (tested) | Version history kept (seen in wrangler deployments list) |
| New version answering | At once, in our tests | The first request after the deploy got the old version; under a minute later, the new one |
| Server code | Pages Functions, billed as Workers requests | Any Worker code; the Workers docs describe "a distinctly broader set of features" |
Our pick: a static site you deploy by hand or from CI is simple on Pages, and the private previews are one button. For a new project that may grow server code, start on Workers: the dashboard already treats Pages as the legacy path. The rest of this guide uses Pages; the Workers test is at the end.
What you need
- A Cloudflare account. The free plan is enough for everything here.
- Node.js and npm on your computer, for Wrangler. We used Node.js 26.13.1.
- Your site, built, in one folder: plain HTML or the output folder of a site generator (often
distorpublic). - For your own domain: a domain whose DNS is on Cloudflare, or a subdomain you can point with a CNAME at your DNS provider.
- For private previews: Cloudflare Zero Trust, which has a free plan (our Zero Trust 101 guide sets it up). Our account already had a team,
nexaforge.
Step 1: Prepare the site folder
Our test site is five pages and a stylesheet in a folder called site. Two extra files hold the production rules. Create site/_headers:
/*
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
/assets/*
Cache-Control: public, max-age=86400
https://:project.pages.dev/*
X-Robots-Tag: noindex- Security headers on every page (
/*):X-Frame-Options: DENYstops pages on another domain from loading yours in a frame,nosniffstops browsers from guessing file types, and the referrer policy sends only your domain name, not the full address, when a visitor follows a link to another domain. - A cache rule for
/assets/*: browsers keep the stylesheet for one day. Use a long time (a year, withimmutable) only when file names change with each build, likestyle.3f9a1c.css; with fixed names, a long cache shows old styles after a deploy. Cloudflare CDN caching explains the two cache layers. noindexon thepages.devaddress only.:projectstands for your project's name, so the rule matchesnexaforge-docs.pages.devbut not your own domain. Search engines then index one copy of the site, on your domain.
Create site/_redirects. Each line is <from> <to> [code]; without a code, Pages uses 302:
/docs /getting-started 301
/start /getting-startedKeep a 404.html at the top of the folder. Without it, Pages treats the site as a single-page app and answers every unknown address with your home page and a 200 status, so broken links never show up as errors.
node -v
tree site
cat site/_headers
cat site/_redirects
Step 2: Create the project by drag and drop
The first upload is easiest in the dashboard. Open Compute > Workers & Pages and create an application. On the Create an app page, select Continue to Pages (the link under the Workers options, shown in the screenshot above), then Drag and drop your files:

Name the project. The name becomes the address, so choose it well: nexaforge-docs gave nexaforge-docs.pages.dev.

Drop the folder, or a zip of it (we used a zip of the same seven files). Check that _headers and _redirects are in the list, then select Deploy site:


One choice is final here: a project made by upload (Direct Upload) cannot switch to Git later. If you want Cloudflare to build from GitHub or GitLab on every push, make a Git project instead. With Direct Upload, you build the site yourself (or in your own CI) and upload the result, which is what the rest of this guide does.
Step 3: Check headers, redirects and the 404 page
Before you add a domain, check that the rule files work. curl -sI asks for the headers only:
curl -sI https://nexaforge-docs.pages.dev/ | grep -iE '^(http|x-frame|x-content|referrer|x-robots)'
curl -sI https://nexaforge-docs.pages.dev/assets/style.css | grep -iE '^(http|cache-control)'
curl -sI https://nexaforge-docs.pages.dev/getting-started.html | grep -iE '^(http|location)'
curl -sI https://nexaforge-docs.pages.dev/docs | grep -iE '^(http|location)'
curl -sI https://nexaforge-docs.pages.dev/start | grep -iE '^(http|location)'
curl -s -o /dev/null -w '%{http_code}\n' https://nexaforge-docs.pages.dev/no-such-pageEverything matched: the three security headers and noindex on the pages.dev address, the one-day cache on the stylesheet, 301 and 302 for the two redirects, and a real 404. Pages also removes .html from addresses by itself, with a permanent 308, so link to /getting-started, not /getting-started.html.

Step 4: Install Wrangler and sign in
Install Wrangler inside the project, as Cloudflare's docs advise, so every machine and your CI use the same version (npm records it in package.json):
npm install --save-dev wrangler
npx wrangler --version
Sign in. wrangler login opens a Cloudflare page in your browser; select Authorize:
npx wrangler login
npx wrangler whoami

Look at the list: the login token can write to Workers, D1, Pages, SSL certificates and more, for the whole account (the browser page counted 30 permissions). That is fine on your own computer. Never copy it to a server or CI; Step 10 makes a token for that. Then check that Wrangler sees the project:
npx wrangler pages project list
Step 5: Deploy from the terminal
Change a page, then deploy the folder to the same project (use your project's name):
npx wrangler pages deploy site --project-name=nexaforge-docs
curl -s https://nexaforge-docs.pages.dev/ | grep ''Wrangler uploads only files that changed (here 1 of 5) plus the two rule files, and prints the new deployment's own address, https://d46f10ff.nexaforge-docs.pages.dev. That address keeps showing this exact version, even after later deploys. The main address switched to version 2 at once.

Step 6: Preview a change before it goes live
Give the deploy any branch name other than the production branch (main here), and it becomes a preview instead of production:
npx wrangler pages deploy site --project-name=nexaforge-docs --branch=staging
curl -s https://staging.nexaforge-docs.pages.dev/ | grep ''
curl -s https://nexaforge-docs.pages.dev/ | grep ''
curl -sI https://staging.nexaforge-docs.pages.dev/ | grep -iE '^(http|x-robots)'The preview gets two addresses: its own (fbedca29.nexaforge-docs.pages.dev) and an alias that always points to the latest deploy of that branch (staging.nexaforge-docs.pages.dev). Production kept version 2, and the preview answered with noindex too. When you deploy from a Git checkout, Wrangler reads the branch name by itself.

Step 7: Add your own domain with HTTPS
Open the project's Custom domains tab and select Set up a custom domain:


If the domain's DNS is on Cloudflare, the dashboard writes the DNS record for you. Read the confirmation screen: our test name already had an A record, and Pages replaced it with a CNAME to nexaforge-docs.pages.dev. If that name serves something else today, it stops the moment you select Activate domain.


The status went from Initializing to Active, with the certificate, in about three minutes. Then check it:
dig +short test.nexaforge.si
curl -sI https://test.nexaforge.si/ | grep -iE '^(http|x-frame|x-robots)'
curl -sI https://nexaforge-docs.pages.dev/ | grep -iE '^(http|x-frame|x-robots)'
curl -sI http://test.nexaforge.si/ | grep -iE '^(http|location)'The name points to Cloudflare, your domain serves the site without noindex while pages.dev keeps it, and plain HTTP is sent to HTTPS with a 301.

Two cases need more care. A bare domain (example.com, no subdomain) only works when the domain's nameservers are Cloudflare's: see how to change nameservers without breaking your services. A subdomain whose DNS is elsewhere works with a CNAME at your DNS provider, but add the domain in Pages first: a CNAME made before that does not resolve and shows error 522.
Step 8: Roll back a bad deploy
Every production deploy stays in the project's list. In Deployments > All deployments, open the menu of the version you want and select Rollback to this deployment:


curl -s https://test.nexaforge.si/ | grep ''
curl -s https://nexaforge-docs.pages.dev/ | grep ''Both addresses served version 1 again right away. Only production deployments are rollback targets, not previews.

Step 9: Make previews private with Cloudflare Access
Previews are public: anyone with the link can open them, and the addresses are easy to guess (the branch name). For unreleased work, put them behind a sign-in. In the project, open Settings > General > Preview access and select Restrict previews:


Pages creates a Cloudflare Access application for *.nexaforge-docs.pages.dev and a policy that lets in the account's members. You find both under Zero Trust, on the Access Applications page. Add your team's e-mail addresses to the policy, or an e-mail domain rule:


Then test four addresses: the branch alias, a preview, production's own deployment address and the production address:
curl -sI https://staging.nexaforge-docs.pages.dev/ | grep -iE '^(http|location)' | cut -c1-90
curl -sI https://fbedca29.nexaforge-docs.pages.dev/ | grep -iE '^(http|location)' | cut -c1-90
curl -sI https://8aa08ee5.nexaforge-docs.pages.dev/ | grep -iE '^(http|location)' | cut -c1-90
curl -sI https://nexaforge-docs.pages.dev/ | grep -iE '^(http|location)'Before the change, all four answered 200. After it, the alias, the preview and even the deployment address of production (8aa08ee5, live again since the rollback in Step 8) send visitors to the Access sign-in page. Only nexaforge-docs.pages.dev stays public, as the settings page says. To keep people off the pages.dev address entirely, Cloudflare's docs suggest a Bulk Redirect from it to your own domain; we kept it, with noindex.


Step 10: Deploy from CI with a token that can only edit Pages
A CI job needs a key that can deploy and nothing else. Make an account API token: open Manage account > Account API tokens and create a token. Give it a name, keep Entire Account, and add one permission: Pages (in the Developer Platform group), Edit. An account token is not tied to a user: Cloudflare's docs describe it as a durable integration with its own permissions, made for CI/CD.

Set an expiry date (we chose 90 days), and if your CI has fixed outgoing addresses, limit the token to them. Review and create it:


Store the token and the account ID as secrets in your CI. Wrangler reads them from two environment variables, so no wrangler login is needed. We tested it with the token in a private file, as a CI secret would be:
export CLOUDFLARE_API_TOKEN="$(cat ~/.cf-pages-token)" CLOUDFLARE_ACCOUNT_ID="$(cat ~/.cf-account-id)"
npx wrangler pages deploy site --project-name=nexaforge-docs
curl -s https://nexaforge-docs.pages.dev/ | grep ''
npx wrangler r2 bucket listThe deploy worked and version 4 went live. The same token then tried to list R2 buckets and got Authentication error [code: 10000]: if it leaks from a CI log, it can publish this project and do nothing else. In a CI job, run the deploy line from a Git checkout, so the branch name decides production or preview. Never commit the token to Git (scan your history for leaked secrets), and delete it when the project is gone; ours was deleted after the test.

The 25 MiB file limit, tested
One file over 25 MiB stops the whole deploy. We put a 26 MiB video in the folder:
ls -lh site/intro-video.mp4
npx wrangler pages deploy site --project-name=nexaforge-docsWrangler refused before it uploaded anything, so the live site was not touched. Keep large videos and downloads in R2 (Cloudflare's object storage, with a public bucket on your domain) and link to them, as Cloudflare's limits page suggests.

The same site on Workers static assets
For the comparison table above, we uploaded the same folder with Upload your static files, the Workers option on the Create an app page. It became a Worker named docs-on-workers:

curl -sI https://docs-on-workers.nexaforge.workers.dev/ | grep -iE '^(http|x-frame|x-content|referrer|x-robots)'
curl -sI https://docs-on-workers.nexaforge.workers.dev/getting-started.html | grep -iE '^(http|location)'
curl -sI https://docs-on-workers.nexaforge.workers.dev/docs | grep -iE '^(http|location)'
curl -s -o /dev/null -w '%{http_code}\n' https://docs-on-workers.nexaforge.workers.dev/no-such-pageThe same _headers and _redirects worked. Two results differ: the noindex rule written for pages.dev does not match a workers.dev address (Cloudflare's headers docs for static assets show a rule for those), and .html is removed with a temporary 307, which the html_handling setting controls.

From the terminal, a Worker needs a wrangler.jsonc file in the project:
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "docs-on-workers",
"compatibility_date": "2026-11-17",
"assets": {
"directory": "./site",
"not_found_handling": "404-page"
}
}npx wrangler deploy
curl -s https://docs-on-workers.nexaforge.workers.dev/ | grep ''
Note the warning: Preview URLs are on by default while the workers.dev address is on. Our first request right after the deploy still got version 1; less than a minute later, version 2 answered, and both versions are in the Worker's history:
curl -s https://docs-on-workers.nexaforge.workers.dev/ | grep ''
npx wrangler deployments list
Production checklist
- Security headers in
_headers, checked withcurl -sI. noindexonhttps://:project.pages.dev/*so only your domain is indexed.- A top-level
404.html, unless the site really is a single-page app. - Long cache times only for files whose names change with each build.
- Previews restricted with Access, and the policy lists only your team.
- Your own domain active, HTTP redirected to HTTPS.
- CI uses an account token with Pages Edit only, an expiry date and a reminder to renew it.
- Every file under 25 MiB; large media in R2.
- Everyone on the team knows where the rollback button is.
Troubleshooting
| What you see | Why | Fix |
|---|---|---|
Pages only supports files up to 25 MiB in size | One file in the folder is over 25 MiB. | Move it to R2 and link to it; the deploy is refused as a whole. |
Pages now has wrangler.jsonc support and missing the "pages_build_output_dir" field | A Workers wrangler.jsonc is in the project folder (ours was left from the Workers test). | Harmless: Wrangler ignores it. To use a config file for Pages, add "pages_build_output_dir": "./site"; or keep the Workers file out of a Pages project. |
Authentication error [code: 10000] | The API token has no permission for that product. | For Pages deploys the token needs the Pages Edit permission. For anything else, make another token. |
A preview link sends you to <team>.cloudflareaccess.com | Restrict previews is on. | Sign in with an allowed e-mail, or add the person to the Access policy. |
| Every unknown address shows the home page with 200 | No top-level 404.html: Pages serves the site as a single-page app. | Add a 404.html at the top of the folder. |
Your custom domain shows error 522 | A CNAME was made at your DNS provider before the domain was added in Pages. | Add the domain in the project's Custom domains tab, so Pages knows it. |
Frequently asked questions
Is Cloudflare Pages free?
Yes. Static requests are free and unlimited on every plan. The free plan has limits on builds (500 a month for Git projects), files (20,000 per site, 25 MiB each), custom domains (100 per project) and projects (100 per account). Everything in this guide ran on the free plan.
How much does Cloudflare Pages cost if I outgrow the free plan?
Static hosting stays free. Cloudflare's Pro and Business plans raise build and domain limits. Server code (Pages Functions) is billed as Workers: 100,000 requests a day free, then Workers Paid from $5 a month with 10 million requests included and $0.30 per extra million.
Is Cloudflare Pages being deprecated?
Cloudflare's docs give no end date (checked 26 November 2026), and existing Pages projects keep working. The direction is clear, though: the dashboard calls it "the legacy Pages workflow", Workers can serve static files for free too, and Cloudflare publishes a guide to move from Pages to Workers. Existing Pages sites can stay; for new projects, look at Workers first.
Cloudflare Pages or Workers for a static site?
Both serve static files free and unlimited, and both read _headers and _redirects. Pages is simpler for previews (a branch name and one button to make them private) and rollbacks. Workers suits projects that will grow server code, since Cloudflare's docs give Workers "a distinctly broader set of features". The comparison table above has our test results.
Cloudflare Pages or Vercel?
For a static site, the main difference is the free allowance. Pages does not charge for static requests at all. Vercel's free Hobby plan includes the first 100 GB of Fast Data Transfer and the first 1,000,000 CDN requests each month (Vercel's Hobby plan page, read 26 November 2026). For frameworks with server rendering, compare the function limits of both before you choose.
Can I use Cloudflare Pages without moving my domain to Cloudflare?
For a subdomain, yes: add it in the project's Custom domains tab first, then create the CNAME to <project>.pages.dev at your DNS provider. A bare domain like example.com needs Cloudflare's nameservers.
What is the file size limit on Cloudflare Pages?
25 MiB per file, on every plan, and 20,000 files per site on the free plan (100,000 on paid plans). In our test, one 26 MiB file stopped the whole deploy.
Can I switch a Direct Upload project to Git later?
No. A project created by upload stays a Direct Upload project. To build from GitHub or GitLab on every push, create a new Git project and move your custom domain to it.
Related guides
- Cloudflare Zero Trust 101: Put a Self-Hosted App Behind Access (Free Plan, 2026)
- Cloudflare CDN Caching for a Self-Hosted Site
- Change Cloudflare Nameservers Without Breaking Self-Hosted Services
- Cloudflare Always Online Alternative: Show a Saved Copy When Your Server Is Down
- Gitleaks 101: Find Leaked Keys in Git History, Remove Them and Block the Next One (2026)
- How to create cloudflare tunnel and expose your services with-synology
- Build a Classic Cloudflare Maintenance Page and Schedule It with Synology
Sources
- Cloudflare Pages docs: limits
- Cloudflare Pages docs: Functions pricing
- Cloudflare Workers docs: pricing
- Cloudflare Pages docs: Direct Upload
- Cloudflare Pages docs: Direct Upload with continuous integration
- Cloudflare Pages docs: headers
- Cloudflare Pages docs: redirects
- Cloudflare Pages docs: serving Pages (routes, 404, single-page apps)
- Cloudflare Pages docs: preview deployments
- Cloudflare Pages docs: custom domains
- Cloudflare Pages docs: rollbacks
- Wrangler commands for Pages
- Cloudflare docs: account-owned API tokens
- Cloudflare Workers docs: static assets
- Cloudflare Workers docs: static assets billing and limitations
- Cloudflare Workers docs: static asset headers
- Cloudflare Workers docs: HTML handling
- Cloudflare Workers docs: migrate from Pages to Workers
- Vercel docs: Hobby plan
Leave a comment
Your email address will not be published. Required fields are marked *
