DEV Community

Discussion on: Building Image CDN with Firebase

Collapse
 
najibghadri profile image
Najib Ghadri

Hi Denis! I like the post, nice architecture, but. I loaded the demo and I don't understand why the initial request takes so long. Say you upload an image, immediately we could start processing each different size and upload it to cdn globally, so no user has to wait for resize processing just download. I mean I compared it to loading instagram.com and that is faster than these small cat images. Am I missing something? Thank you.

Collapse
 
najibghadri profile image
Najib Ghadri

Oh, or is it because the cdn cache is very short lived i.e. couple of minutes only? If so is it something you can define in the firebase.json or console?

Collapse
 
najibghadri profile image
Najib Ghadri

Okey, bruh, got it. You set both cdn and browser cache max-age to 300s. If I wanted to set a different cache for CDN there is s-maxage header. Docs: firebase.google.com/docs/hosting/m.... Peace ✌️