Pages Direct Upload API Success Leads to 500/522 Errors (Manual Upload Works)

For Workers & Pages, what is the name of the domain?

launchforge-user-pages.pages.dev

What is the error number?

500 (when accessing the *.pages.dev URL directly after API upload)

What is the error message?

On *.pages.dev: HTTP ERROR 500 - [project-name].pages.dev is currently unable to handle this request. On custom hostname: Connection timed out

What is the issue or error you’re encountering

We are using the Cloudflare Pages Direct Upload API (POST /accounts/{account_id}/pages/projects/{project_name}/deployments) to deploy a single index.html file to the root of our Pages project (launchforge-user-pages.pages.dev). This project serves as the origin for custom hostnames managed via Cloudflare for SaaS on our main zone (launchforge.com). The API call reports success (200 OK) and shows “Success” in the Pages deployment dashboard. However, attempting to access the deployed *.pages.dev URL results in a 500 error. Consequently, the custom hostnames pointing to this project via Cloudflare for SaaS also fail, typically with a 522 timeout error. Crucially, if we manually upload the exact same simple index.html file via the Cloudflare Pages dashboard UI, the *.pages.dev URL works perfectly. This suggests the issue is specific to the Direct Upload API process for the root index.html file.

What steps have you taken to resolve the issue?

Verified Cloudflare for SaaS configuration is active and the Fallback Origin CNAME points correctly to launchforge-user-pages.pages.dev.
Verified the relevant Custom Hostname status is “Active” for both Certificate and Hostname status.
Confirmed DNS propagation.
Tested deploying a very simple, minimal index.html via the API - still resulted in 500/522 errors.
Tested using both /index.html (resulted in 500/522) and index.html (resulted in 404) as the key in the manifest and FormData for the API upload. The leading slash seems necessary for the root path but leads to the 500/522 error state when used with the API.
Performed a manual UI upload of a simple index.html to the same Pages project - this worked correctly and the .pages.dev URL became accessible.

What are the steps to reproduce the issue?

Have a Cloudflare Pages project set up for static hosting (no build command).
Make an API call to POST /accounts/{account_id}/pages/projects/{project_name}/deployments.
Include FormData with:
A manifest part containing the JSON string: {“/index.html”: “”}
A /index.html part containing the HTML file content as a Blob (type: “text/html”).
Observe that the API call returns 200 OK and the deployment shows success in the dashboard.
Attempt to access the resulting *.pages.dev deployment URL.
Observe the HTTP 500 error.

This topic was automatically closed after 15 days. New replies are no longer allowed.