|
1 | 1 | --- |
2 | | -description: Safely collect useful details when diagnosing failed requests to Craft Cloud. |
| 2 | +description: Diagnose failed requests to Craft Cloud. |
| 3 | +pageClass: cloud-diagnostics |
3 | 4 | --- |
4 | 5 |
|
5 | 6 | # Diagnostics |
6 | 7 |
|
7 | 8 | ## Response Headers |
8 | 9 |
|
9 | | -- `cf-*` headers come from Cloudflare. |
10 | | -- `x-gateway-*` headers are added by the Craft Cloud gateway. |
11 | | -- All other headers are returned by the origin (Craft). |
| 10 | +- `cf-*`: Cloudflare |
| 11 | +- `x-gateway-*`: Craft Cloud gateway |
| 12 | +- All others: origin (Craft) |
12 | 13 |
|
13 | 14 | | Response Header | Description | |
14 | 15 | | --- | --- | |
15 | | -| <code style="white-space: nowrap;">x-gateway-flow</code> | Identifies how Craft Cloud produced the response. `/origin/fetch` means the gateway fetched the environment’s origin, while `/origin/reject` means it rejected the request before contacting the origin. | |
16 | | -| <code style="white-space: nowrap;">x-gateway-http-signature</code> | Reports whether Craft Cloud detected and validated [request signing](request-signing.md). `verified` means validation succeeded; `unverified` means signing was detected but validation failed. | |
17 | | -| <code style="white-space: nowrap;">cf-ray</code> | Identifies the request in Cloudflare. For [Cloudflare O2O](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/saas-customers/how-it-works/), this is the customer zone Ray ID. | |
18 | | -| <code style="white-space: nowrap;">cf-cache-status</code> | Describes how Cloudflare handled the response in the cache. For Cloudflare O2O, this is the customer zone cache status. See [Troubleshooting Static Caching](static-caching.md#troubleshooting) for common values. | |
19 | | -| <code style="white-space: nowrap;">x-gateway-cf-ray</code> | For Cloudflare O2O, the Ray ID for Craft Cloud’s SaaS provider zone. | |
20 | | -| <code style="white-space: nowrap;">x-gateway-cf-cache-status</code> | For Cloudflare O2O, the cache status for Craft Cloud’s SaaS provider zone. | |
| 16 | +| `x-gateway-flow` | How Craft Cloud produced the response. For example, `/origin/fetch` reached Craft. | |
| 17 | +| `x-gateway-http-signature` | [Request-signing](request-signing.md) result. `verified` succeeded; `unverified` was detected but failed validation. | |
| 18 | +| `cf-ray` | Cloudflare request ID.<sup>1</sup> | |
| 19 | +| `cf-cache-status` | Cloudflare [cache status](static-caching.md#troubleshooting).<sup>1</sup> | |
| 20 | +| `x-gateway-cf-ray` | Cloudflare request ID.<sup>2</sup> | |
| 21 | +| `x-gateway-cf-cache-status` | Cloudflare [cache status](static-caching.md#troubleshooting).<sup>2</sup> | |
| 22 | + |
| 23 | +<sup>1</sup> With [Cloudflare O2O](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/saas-customers/how-it-works/) requests, the marked headers describe the customer zone. |
| 24 | + |
| 25 | +<sup>2</sup> The marked headers describe the Craft Cloud zone and are only present with [Cloudflare O2O](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/saas-customers/how-it-works/) requests. |
21 | 26 |
|
22 | 27 | ## Interpreting Failures |
23 | 28 |
|
24 | | -A status code describes the outcome, but not which layer produced it. Combine |
25 | | -it with `x-gateway-flow` and the other diagnostic headers: |
| 29 | +Status alone does not identify the response layer. Use it with the diagnostic |
| 30 | +headers: |
26 | 31 |
|
27 | 32 | | Status | Response Headers | Interpretation | |
28 | 33 | | --- | --- | --- | |
29 | | -| `4xx/5xx` | `x-gateway-flow: /origin/fetch` | Your application returned the response. Inspect its logs and error handling. | |
30 | | -| `400` | `x-gateway-flow: /origin/reject` | The request body failed gateway validation. Fix the request rather than retrying it unchanged. | |
31 | | -| `401` | `x-gateway-http-signature: unverified` | A signature-protected gateway endpoint rejected an invalid or expired signature. Check the signing key, method, target URL, timestamp, and expiry before signing again. | |
32 | | -| `403` | `x-gateway-flow: /origin/reject` | A gateway request policy blocked the request before it reached your application. Do not retry it unchanged. | |
33 | | -| `404` | `x-gateway-flow: /` | The gateway could not match the hostname to a Craft Cloud environment. Check the requested hostname. | |
34 | | -| `413` | `x-gateway-flow: /origin/reject` | The request body was too large for the origin request path. Reduce its size. | |
35 | | -| `429` | `x-gateway-flow: /origin/reject` and `Retry-After` | The gateway rate limited the request before it reached your application. Honor `Retry-After`. A `verified` signature confirms signing worked, but does not bypass shared capacity limits. | |
36 | | -| `429` | `x-gateway-flow: /origin/fetch` | Your application returned the rate limit. Honor its `Retry-After` header, if present, and inspect application-level limits. | |
37 | | -| `500` | `x-gateway-flow` ending in `/error` | The gateway encountered an internal error. Retry only safe requests, and contact support if it persists. | |
38 | | -| `502` | `x-gateway-flow: /origin/fetch/error` | The gateway could not get a usable response from the origin after a connection or platform error. Contact support if it persists. | |
39 | | -| `503` | `x-gateway-flow: /origin/fetch/error` and `Retry-After` | Origin compute was temporarily throttled. Honor `Retry-After` before retrying a safe request. | |
40 | | -| `504` | `x-gateway-flow: /origin/fetch/error` | Origin work exceeded the [request duration limit](quotas.md#requests-responses). Reduce the work performed during the request. | |
41 | | -| `5xx` | No `x-gateway-flow` | The failure may have occurred before the request reached the gateway. Preserve the Ray IDs and `Retry-After`, if present, when contacting support. | |
| 34 | +| `4xx/5xx` | `x-gateway-flow: /origin/fetch` | Returned by Craft; check application logs. | |
| 35 | +| `400/403/413` | `x-gateway-flow: /origin/reject` | Detected invalid or malicious request. | |
| 36 | +| `401` | `x-gateway-http-signature: unverified` | The signature was invalid or expired. | |
| 37 | +| `404` | `x-gateway-flow: /` | Hostname did not match a Craft Cloud environment. | |
| 38 | +| `429/503` | `Retry-After: 𝑛` | Automate retry, honoring `Retry-After`. | |
| 39 | +| `500/502` | No `x-gateway-flow: /origin/fetch` | A gateway error occurred; contact support if it persists. | |
| 40 | +| `504` | `x-gateway-flow: /origin/fetch/error` | The origin exceeded the [request duration limit](quotas.md#requests-responses). | |
| 41 | +| `5xx` | No `x-gateway-flow` | The error occurred before the gateway, either in the `craft.cloud` zone or a parent Cloudflare zone. | |
0 commit comments