Cloudflare-IPFS gateway corrupts (cuts-off) files


There’s ongoing issue with Cloudflare IPFS gateway, which affects only some Cloudflare IPFS PoPs (≈regions) and happens quite frequently.
The gateway does not serve the whole file and cuts it off in different places, for the whole file cache lifetime.

Here’s the example of such file:

It is 676614 bytes in size, but the real file is 950 kB.

Once the file is cached being cut-off, it is served in this state all the time in the same region, while the other regions are not affected, which encumbers debugging the issue.
Opening the file using other IPFS gateways, such as, returns full uncut file:

The full file has “return “DIRECT”;” string in the end of it.

Cut-off file served on Russian Cloudflare PoP:

I’ve tried to pre-download the file over multiple gateways before serving it on the website, but that doesn’t help much, it still eventually getting served broken in some regions but not in other.

This file has been broken in Russia since 26 December and is still served cut-off:

Please check what could be wrong with the gateway.

This post was flagged by the community and is temporarily hidden.

I’m seeing the same problem for Loading it in your browser you can see that only the first half of the image is returned. returns the full image as expected.

Indeed, the link loads only half of the image for me. Cloudflare node in Sweden.
I’ve filled the ticket #2347312 to Cloudflare support. In fact, it was filled before my first forum post. I’ve updated the ticket with your URL.

Interesting. I am unlikely to be hitting the same edge as you so it looks like this issue is affecting multiple edge locations. Maybe they are doing tired caching or something or maybe it is a reproducible bug.

Example request:

HTTP/1.1 200 OK
Date: Sun, 23 Jan 2022 21:10:47 GMT
Content-Type: image/jpeg
Transfer-Encoding: chunked
Connection: keep-alive
CF-Ray: 6d2402c36cdc2a3c-ORD
Access-Control-Allow-Origin: *
Age: 11945
Cache-Control: max-age=86400
ETag: W/"QmTfXoED9voY5sT6Fmm1GhzJBriYrsXUw8Exd4Gzp3z9ue"
Last-Modified: Thu, 01 Jan 1970 00:00:01 GMT
Vary: X-Ipfs-Secure-Gateway, Service-Worker, Accept-Encoding
CF-Cache-Status: HIT
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Headers: Range
Access-Control-Allow-Headers: User-Agent
Access-Control-Allow-Headers: X-Requested-With
Access-Control-Allow-Methods: GET
Access-Control-Expose-Headers: Content-Range
Access-Control-Expose-Headers: X-Chunked-Output
Access-Control-Expose-Headers: X-Stream-Output
Expect-CT: max-age=604800, report-uri=""
X-Ipfs-Path: /ipfs/QmTfXoED9voY5sT6Fmm1GhzJBriYrsXUw8Exd4Gzp3z9ue
X-Ipfs-Root-Cid: QmTfXoED9voY5sT6Fmm1GhzJBriYrsXUw8Exd4Gzp3z9ue
Set-Cookie: __cf_bm=REDACTED; path=/; expires=Sun, 23-Jan-22 21:40:47 GMT;; HttpOnly; Secure; SameSite=None
Server: cloudflare