Supabase cache max-age not being respected by Chrome

626 views Asked by At

I have updated the cache max age for my images in Supabase to 15552000 seconds (6 months), since my files will be static.

However, when I check the network tab in Chrome, the max-age is still 3600.

I have made sure that it was not because it was the old cache still working, but even after clearing the cache or waiting for the hour to pass, the max-age is still the same, 3600.

enter image description here

Even though the metadata of my image clearly indicates the max-age:

enter image description here

I am currently using the Supabase image URL instead of downloading the image, does that affect the result?

I also added an htaccess file with this code in it:

<FilesMatch "\.(ico|pdf|flv|jpg|webp|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=15552000, public" </FilesMatch>

Am I missing something?

Update: New images uploaded do have the max-age OK.

1

There are 1 answers

0
MIPB On BEST ANSWER

After discussing it in the Supabase Discord we determined it may have to do with the server cache, apperently with the new CDN.

To solve the issue and get a new max-age on cache, you will have to delete all the files in the storage and replace them with the same ones with new names.

Don't upload them through the dashboard because it will automatically set it to 3600.

If anyone is interested I opened two issues in the Supabase repo: