Storage: File is not caching and returns cache-control private, no-cache

When you check whether a file is cached, the cache-control header returns private, no-cache and cf-cache-status does not return HIT.

Cause

You probably sent a HEAD request. Smart CDN doesn’t cache HEAD requests.

Fix

Send a GET request instead.

Send a regular request

curl -sD - -o /dev/null \
https://<project-ref>.supabase.co/storage/v1/object/public/<bucket>/<file>

Send a range request

To avoid downloading the whole file, request only the first byte. The server responds with 206 Partial Content and a 1-byte body:

curl -sD - -r 0-0 -o /dev/null \
https://<project-ref>.supabase.co/storage/v1/object/public/<bucket>/<file>

Check the cache status

The cf-cache-status response header shows whether the CDN cached the object. HIT means the CDN sent the object from its cache. MISS means the CDN fetched it from the origin server.

Go to the GitHub discussion