Pages: all json files (and only json) return 500 HTTP code with empty body

Very standard setup - basic Gatsby site, deploy setup exactly the same as cf example. No workers running.

Builds and deploys without any issues.
All files load without any errors with the exception of *.json files, which return a HTTP 500 response with empty body.

Tested on both preview site and custom domain across multiple deploys.

What’s the link? Also, it seems more like an 520: Web orgin returns unknown error, but both error code 500 and 520 troubleshooting steps are below.

Error 500: internal server error

Error 500 generally indicates an issue with your origin web server. Error establishing database connection is a common HTTP 500 error message generated by your origin web server. Contact your hosting provider to resolve.


Provide details to your hosting provider to assist troubleshooting the issue.

However, if the 500 error contains “Cloudflare” or “Cloudflare-nginx” in the HTML response body, provide Cloudflare support with the following information:

  1. Your domain name
  2. The time and timezone of the 500 error occurrence
  3. The output of from the browser where the 500 error was observed (replace with your actual domain and host name)

If you observe blank or white pages when visiting your website, confirm whether the issue occurs when temporarily pausing Cloudflare and contact your hosting provider for assistance.

Error 520: web server returns an unknown error

Error 520 occurs when the origin server returns an empty, unknown, or unexpected response to Cloudflare.


A quick workaround while further investigating 520 errors is to either grey cloud the DNS record in the Cloudflare DNS app or temporarily pause Cloudflare.

Contact your hosting provider or site administrator and request a review of your origin web server error logs for crashes and to check for these common causes:

  • Origin web server application crashes
  • Cloudflare IPs not allowed at your origin
  • Headers exceeding 32 KB (typically due to too many cookies)
  • An empty response from the origin web server that lacks an HTTP status code or response body
  • Missing response headers or origin web server not returning proper HTTP error responses

520 errors are prevalent with certain PHP applications that crash the origin web server.

If 520 errors continue after contacting your hosting provider or site administrator, provide the following information to Cloudflare Support:

What’s the link? Also, it seems more like an 520: Web orgin returns unknown error, but both error code 500 and 520 troubleshooting steps are below.

This is an issue with Cloudflare Pages. There is no origin server that we control.

After some late night discussion on Discord it has been confirmed as a bug in Pages and a workaround has been deployed a couple minutes ago. Requires new deploy on Pages to take effect. Full fix will follow later and will likely require another deploy.

Have you tried reading my response before replying?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.