Vai al contenuto
Blog

Cloudflare Pages 404 or blank page after zip upload

Cloudflare Pages shows a 404 or blank page after a zip upload? index.html is probably nested in a folder. Here is how to check and fix it.

The Liite team8 min di lettura

Short answer

index.html is almost certainly not at the top level of what you uploaded. Re-zip the contents of your build folder (not the folder itself), or drag in the output folder such as dist, and deploy again. Then open the root URL in a private window.

You dragged a zip onto Cloudflare Pages, the deploy said it succeeded, and your *.pages.dev address shows a 404 or a blank page. You searched for something like cloudflare pages 404 after upload zip or cloudflare pages blank page.

Why it happens

Cloudflare's own docs name the most common cause. If you get 404 errors on your .pages.dev domain, your site needs a top-level index.html, which is what Pages serves on the apex with no page specified. Cloudflare's Direct Upload guide says drag and drop accepts a zip file or single folder of assets. It does not say what happens when the zip wraps everything in an extra folder. Threads on Reddit and the Cloudflare community forum (one titled "Page won't load") suggest that this is exactly where people go wrong.

Causes, most common first:

  1. You zipped the parent folder. Right-click, compress, and you get a zip with one folder inside. index.html sits inside that folder, not at the top.
  2. You uploaded the project root, not the build output. With a framework or bundler, the real site is in dist, build or out. Uploading the whole project puts source files at the top and the built site one level down. One person in those threads found their site loading at /dist, which is this mistake.
  3. The file name is wrong. Index.html or home.html is not index.html.
  4. The root loads, but assets 404. The page looks blank because its scripts or stylesheets can't be found. This is a different failure from a 404 on /.
  5. Single-page app routing hides the real problem. If a project has no top-level 404.html, Pages assumes it is a single-page application. Pages then serves the root (/) for any path that doesn't match a static asset. If your root has no page, those fallbacks have nothing useful to return, and you may see an empty result rather than a clear error. I could not confirm the exact blank-page behavior from Cloudflare's docs, so treat this one as a likely explanation, not a proven one.
SymptomLikely causeFix
404 on /index.html is nested in a folderRe-zip the contents, not the folder
Site works at /dist or /my-site/Wrapper or output folder uploaded wholeUpload the contents of that folder
Blank page, root returns 200Assets 404 in the Network tabFix the folder layout and asset paths
404 only on /aboutNo about.html or about/index.htmlAdd the page, or check routing
Red warning on a file in the upload frameFile over the size limitShrink it and re-upload the project

How to fix it

1. Check the first level of your zip

Open the zip without extracting it. You should see index.html right there, next to your CSS, JS and asset folders. If you see one folder and index.html is inside it, that is your problem.

2. Re-zip the contents, not the folder

  1. Open the folder that holds your finished site.
  2. Select everything inside it, not the folder itself: index.html, the asset folders, all of it.
  3. Compress that selection.
  4. Open the new zip and confirm index.html is on the first level.

Tip

On macOS, compressing a folder always wraps it in that folder. Open the folder, press Command+A, then right-click and compress the selection.

3. If you build the site, upload only the output

Use the contents of dist, build or out, whichever your tool produces. Do not upload the project root, node_modules or source files. A static upload only needs what visitors' browsers load.

4. Or drag the folder instead of a zip

Cloudflare's docs list a single folder of assets as a valid drag-and-drop input, so you can skip zipping. Drag the output folder itself and confirm in the file list that index.html appears at the top. Cloudflare's docs say the drag-and-drop path steps are Create application > Get started > Drag and drop your files, then name the project, add your assets and select Deploy site. Menu labels change over time, so if yours differ, look for the Direct Upload option in the Workers & Pages area.

5. Check the file name

It should be exactly index.html, all lowercase. Rename it if needed and rebuild the zip.

6. Redeploy and test the root URL

Open https://<project>.pages.dev/ in a private window so a cached copy doesn't fool you. Test / first, then one inner page.

7. If the root loads but the page is blank

Open your browser's developer tools and check the Console and Network tabs for requests that return 404. A build made for the site root asks for files like /assets/app.js. If those files ended up in a subfolder, the requests fail and nothing draws. Fix the folder layout rather than editing paths by hand. If your framework builds for a subpath, set its base path to / and rebuild.

8. If your project is connected to Git, not a zip

The same rule applies to the build output directory in the project's settings. It must point at the folder that contains index.html. Cloudflare's docs also note you cannot use drag and drop on the dashboard with existing Git-integrated projects, so a zip upload may not even be available for those.

Warning

Cloudflare's docs say that if you pick Direct Upload, you cannot switch to Git integration later. If you want automatic deploys, create a new Git-connected project instead of fighting this one.

What won't help

  • Waiting. A missing root index.html doesn't appear once the deploy propagates.
  • Redeploying the same zip or renaming the project. The same layout gives the same result.
  • Using /dist as a permanent address. It may show the site, but the real address stays broken, and assets built for the root often fail from a subfolder.
  • Adding extra files at the root. They don't help if the real index.html is still nested.
  • Adding a 404.html to hide the problem. It changes what the error page looks like, not whether your home page exists.

Checklist before you try again

  • The first level of the zip shows index.html.
  • The file is named exactly index.html, lowercase.
  • Only finished output is included, with no node_modules or source folders.
  • No single file is over Cloudflare's drag-and-drop limit. Cloudflare lists 1,000 files and 25 MiB file size for drag and drop.
  • You tested / in a private window, then one inner page.
  • The Network tab shows no 404s for scripts or stylesheets.

If nothing works

Ask in Cloudflare's community forum or contact Cloudflare Support from your dashboard. Include:

  • the *.pages.dev URL and the deployment ID or time of the deploy;
  • what you see at / (404, blank, or something else) and any failing requests from the Network tab;
  • a screenshot of the first level of your zip or folder;
  • how you deployed (drag and drop, Wrangler or Git) and what you already tried.
Subject: Pages deployment returns 404 / blank page at the root

Project: <project-name>.pages.dev
Deployed: <date and time, with time zone>
Method: drag and drop, zip file

Opening the root URL shows a <404 / blank page>.
The first level of my zip contains: <list what you see>.
I re-zipped the contents of the build folder and redeployed: <yes/no>.
Network tab shows these failing requests: <paths and status codes>.

Can you confirm what Pages sees as the top level of this deployment?

If you'd rather not re-zip again

Liite's uploaded sites handle the most common version of this mistake. A single wrapper folder in a zip or a dropped folder is stripped automatically, nested wrappers too, so my-site/index.html works without re-zipping. __MACOSX, .DS_Store and hidden files are dropped as well. You can drop an HTML file, a zip or a folder and get a link at <slug>.liite.site.

index.html still has to be at the top level or inside that wrapper folder, so the build-output advice above still applies. Liite doesn't run server-side code or build from source, so it only suits finished static files. A Free uploaded site needs a card on file, is capped at 3 MB, and goes offline 7 days after its last publish. Pro raises the cap to 25 MB and the site doesn't expire. See put an HTML file, a zip or a PDF online for the steps, or the uploaded sites docs.

Common questions

Why does my site load at /dist but not at /?

Your upload contains a dist folder, and the site inside it is intact. Pages serves it at that path because that is where the files are. Upload the contents of dist and it will appear at /.

Does it matter which tool I use to zip?

No, the selection matters. Compress the files inside the folder, then open the result and check that index.html is on the first level.

Do I get a 404 on inner pages even though the home page works?

That is a separate issue. Pages serves a file only if it exists in the upload, and its SPA fallback applies when there is no top-level 404.html. Check that the inner page exists as a file, and read Cloudflare's Serving Pages docs for route matching.

Can I just use Cloudflare Drop instead?

Cloudflare's changelog describes Cloudflare Drop as taking a folder or zip file of static assets and giving a temporary live preview that stays live for 1 hour. It is a quick test, not a permanent deployment unless you claim it. A nested index.html is still the likeliest cause of a 404 there too, though the changelog doesn't say so.