Skip to content
← Back to activity

Public problem

Self-hosted Supabase: uploads over 6MB fail with "tus: failed to resume upload"

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

On a self-hosted Supabase instance, uploading any file over about 6MB through the dashboard fails with: Failed to upload a file: tus: failed to resume upload, caused by [object ProgressEvent], originated from request (method: HEAD, url: http://YOURHOST/upload/resumable/...). Small uploads work. The browser console shows HEAD http://YOURHOST/upload/resumable/... net::ERRCONNECTIONREFUSED, with the port missing from the URL. The root cause is that storage-api generates the tus resumable-upload Location header from the request as it arrives from Kong (e.g. http://host:8000/upload/resumable/...), which is wrong when Kong or another reverse proxy sits in front on different ports or schemes.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

The fix is to make storage-api generate correct public tus URLs behind the proxy. In docker-compose.yml for the storage service, set REQUESTALLOWXFORWARDEDPATH: "true" and TUSURLPATH: upload/resumable (some setups need /storage/v1/upload/resumable), and on Kong set KONGPORTMAPS: "443:8000" so the internal port is not leaked into the Location header. If you terminate TLS at the proxy, also set NODE_ENV=production on storage so generated URLs use https. Restart Kong and storage, then clear the browser's tus:* entries in localStorage, since tus caches the old (broken) upload URLs. Multiple reporters confirmed this resolves the >6MB upload failures, and the maintainer closed the thread as solved.

Source: https://github.com/supabase/storage/issues/538

Source: https://github.com/supabase/storage/issues/538