|
| 1 | +--- |
| 2 | +title: JSON responses and RFC 9457 support for Cloudflare 1xxx errors |
| 3 | +description: "Cloudflare-generated 1xxx errors now return structured JSON when requested with 'Accept: application/json' or 'Accept: application/problem+json', following RFC 9457 (Problem Details for HTTP APIs)." |
| 4 | +products: |
| 5 | + - fundamentals |
| 6 | +date: 2026-03-11 |
| 7 | +--- |
| 8 | + |
| 9 | +Cloudflare-generated 1xxx errors now return structured JSON when clients send `Accept: application/json` or `Accept: application/problem+json`. JSON responses follow [RFC 9457 (Problem Details for HTTP APIs)](https://www.rfc-editor.org/rfc/rfc9457), so any HTTP client that understands Problem Details can parse the base members without Cloudflare-specific code. |
| 10 | + |
| 11 | +## Breaking change |
| 12 | + |
| 13 | +The Markdown frontmatter field `http_status` has been renamed to `status`. Agents consuming Markdown frontmatter should update parsers accordingly. |
| 14 | + |
| 15 | +## Changes |
| 16 | + |
| 17 | +**JSON format.** Clients sending `Accept: application/json` or `Accept: application/problem+json` now receive a structured JSON object with the same operational fields as Markdown frontmatter, plus RFC 9457 standard members. |
| 18 | + |
| 19 | +**RFC 9457 standard members (JSON only):** |
| 20 | + |
| 21 | +- `type` — URI pointing to Cloudflare documentation for the specific error code |
| 22 | +- `status` — HTTP status code (matching the response status) |
| 23 | +- `title` — short, human-readable summary |
| 24 | +- `detail` — human-readable explanation specific to this occurrence |
| 25 | +- `instance` — Ray ID identifying this specific error occurrence |
| 26 | + |
| 27 | +**Field renames:** |
| 28 | + |
| 29 | +- `http_status` -> `status` (JSON and Markdown) |
| 30 | +- `what_happened` -> `detail` (JSON only — Markdown prose sections are unchanged) |
| 31 | + |
| 32 | +**Content-Type mirroring.** Clients sending `Accept: application/problem+json` receive `Content-Type: application/problem+json; charset=utf-8` back; `Accept: application/json` receives `application/json; charset=utf-8`. Same body in both cases. |
| 33 | + |
| 34 | +## Negotiation behavior |
| 35 | + |
| 36 | +| Request header sent | Response format | |
| 37 | +| ----------------------------------------------- | ---------------------------------------------- | |
| 38 | +| `Accept: application/json` | JSON (`application/json` content type) | |
| 39 | +| `Accept: application/problem+json` | JSON (`application/problem+json` content type) | |
| 40 | +| `Accept: application/json, text/markdown;q=0.9` | JSON | |
| 41 | +| `Accept: text/markdown` | Markdown | |
| 42 | +| `Accept: text/markdown, application/json` | Markdown (equal `q`, first-listed wins) | |
| 43 | +| `Accept: */*` | HTML (default) | |
| 44 | + |
| 45 | +## Availability |
| 46 | + |
| 47 | +Available now for Cloudflare-generated 1xxx errors. |
| 48 | + |
| 49 | +## Get started |
| 50 | + |
| 51 | +```bash |
| 52 | +curl -s --compressed -H "Accept: application/json" -A "TestAgent/1.0" -H "Accept-Encoding: gzip, deflate" "<YOUR_DOMAIN>/cdn-cgi/error/1015" | jq . |
| 53 | +``` |
| 54 | + |
| 55 | +```bash |
| 56 | +curl -s --compressed -H "Accept: application/problem+json" -A "TestAgent/1.0" -H "Accept-Encoding: gzip, deflate" "<YOUR_DOMAIN>/cdn-cgi/error/1015" | jq . |
| 57 | +``` |
| 58 | + |
| 59 | +References: |
| 60 | +- [RFC 9457 — Problem Details for HTTP APIs](https://www.rfc-editor.org/rfc/rfc9457) |
| 61 | +- [Cloudflare 1xxx error documentation](/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/) |
0 commit comments