Hi all,
I’m using tusd behind a Cloudflare proxy. Uploads seem to complete — the file size exactly matches the original file on the client. However, after upload:
- The resulting file has a different SHA-256 hash
- The uploaded video is corrupted
Here is an excerpt from the tusd logs during the problematic upload:
1750237625900 [tusd] 2025/06/18 09:07:05.900871 event="ResponseOutgoing" status="500" method="PATCH" path="/api/v1/tus/upload/e006bd335374fbf6c26c3e492e827683" error="read tcp: connection reset by peer" requestId=""
1750237625900 [tusd] 2025/06/18 09:07:05.900837 event="ChunkWriteComplete" id="e006bd335374fbf6c26c3e492e827683" bytesWritten="8527872"
1750237625900 [tusd] 2025/06/18 09:07:05.900815 event="BodyReadError" id="e006bd335374fbf6c26c3e492e827683" error="read tcp 10.93.30.126:3001->10.93.30.27:62392: read: connection reset by peer"
1750237622826 [tusd] 2025/06/18 09:07:02.826004 event="ChunkWriteStart" id="e006bd335374fbf6c26c3e492e827683" maxSize="16777216" offset="2349973504"
My questions:
- How could the final file have the correct size but still be corrupted / wrong hash?
- Does
tusdflush incomplete chunk writes even on aBodyReadError? - What can I do to ensure data integrity if a
PATCHrequest is interrupted? - Is there a way to prevent
tusdfrom finalizing the upload if there’s a read error or TCP reset mid-chunk?
Some context:
- Tus-js-client is used.
- tusd (GitHub - tus/tusd: Reference server implementation in Go of tus: the open protocol for resumable file uploads) is running with shared storage.
- We use Cloudflare load balancing with sticky sessions.
Any ideas or suggestions?
Thanks!