How to host HTML export on Cloudflare Pages, and what stops working there
Anticode's HTML export is plain static files, so Cloudflare Pages can serve it straight from a drag-and-drop upload: no build step, no framework setting. The page looks and behaves the same, with one large exception. Its booking, contact and newsletter forms post to Anticode's servers, and on Pages there's nothing at those addresses until you add a handler yourself.
When Pages is a sensible home
A static copy suits pages whose job is to be read: a portfolio, a menu, an event page after the event, a backup of a site you're retiring, or a page you want under an account you already run on Cloudflare. If people will still send you bookings or messages through it, either keep the site on Anticode or take the Next.js export to a host that runs Node, because a dropped folder has no server behind it.
Prepare the files
Turn on Pro mode in the builder, open the Code tab and press HTML. What you get depends on the site:
- A one-page site
- One file named after the project, for example
atelier-nord.html. Rename it toindex.htmland put it in a folder of its own, so it answers at the root address. - A site with separate pages
- A
<name>-site.zipwithindex.htmlat the top and a folder per page, each with its ownindex.html. Links between them are relative, so the zip can go up exactly as it is.
Upload it in the Cloudflare dashboard
Cloudflare's direct upload guide gives these steps:
- Open Workers & Pages in the Cloudflare dashboard.
- Choose Create application, then Get started, then Drag and drop your files.
- Name the project and choose Deploy site.
- Drop the folder or the zip into the upload area, wait for every file to finish, then choose Save and Deploy.
Drag and drop takes a single folder or a zip, up to 1,000 files and 25 MiB per file, which an Anticode export is nowhere near. To publish a change, export again and upload a new deployment to the same project, and keep the downloaded copy of the previous version until the new one checks out.
What carries over unchanged
- The design. All the CSS is inline in one
<style>block, and the one typeface loads from Google Fonts. - Photos from Anticode's curated library, which load from images.unsplash.com with their written alt text.
- The page's own security policy. A meta Content-Security-Policy with
script-src 'none'travels inside the file, so Pages serves a page that still refuses scripts. - Buy and pricing buttons, which are ordinary links to your payment provider's checkout and work anywhere.
Forms: the part that needs a server
In the export, the booking form's action is /api/bookings, the contact form's /api/contact and the newsletter's /api/subscribe. On Anticode, those paths validate the submission, seal it and hand it to your connectors. On Pages, a visitor who presses send reaches an address with no handler and gets an error. The meta policy's form-action 'self' also means the forms can only post back to the same site, so pointing them at a third-party form service would need the policy edited as well.
You have three honest options. Replace each form with a mailto: link or a link to a booking page elsewhere. Write your own handler at those paths; Cloudflare notes that drag and drop doesn't accept a functions folder, so that means deploying with Wrangler, or a _worker.js file, which works with both methods. Or keep forms on Anticode, where the form connectors already deliver to Slack, Sheets and the rest.
Also left behind
- Fresh booking days. The calendar is frozen at the days it showed when you exported.
- Generated files: robots.txt, sitemap.xml, llms.txt, the Privacy and Terms pages, CMS collection pages and the security report.
- Visit counts. Anticode's cookie-free analytics only count the copy it hosts.
- Two-way editing. Edits to the uploaded files don't reach your project; edit in Anticode and export again.
Troubleshooting
- The root address shows nothing
- The single-file export wasn't renamed to
index.html. - Inner pages show a 404
- Check you uploaded the zip's whole folder structure, not only the top
index.html: each page lives in a folder of its own. - A file is flagged in red during upload
- It's over the size limit; Cloudflare's guide says you then have to upload the whole project again.
- Sending a form shows an error
- Expected: see the forms section above.
For everything the HTML download contains, see HTML export and the guide to downloading a website as HTML. If you'd like Netlify instead, the Netlify page covers both exports there.
Questions people ask
Does Cloudflare Pages accept the zip directly?
Yes. Its drag and drop takes either a zip or a single folder. The single-file export still needs renaming to index.html.
Can I add a function to handle the contact form?
Yes, but not through drag and drop, which ignores a functions folder. Deploy with Wrangler, or use a _worker.js file.
Will the page run scripts I add?
Not unless you also change its built-in policy, which sets script-src to none. That's deliberate: the page was checked with no scripts.
Is this the same as connecting my Cloudflare domain to Anticode?
No. That keeps the site hosted on Anticode and only adds a DNS record; see Cloudflare DNS.
Sources
- Cloudflare Pages Docs: Direct Upload, checked