Score:0

Why browsers fetch images again after reloading my page?

in flag

I am developing a web app, and I want all the images (a couple hundred MB worth - 20 000 - 50 000 thumbnails) to be downloaded once and never downloaded again, as those don't really change. Also, those images are downloaded from youtube servers, and I don't want to hammer their servers unnecessarily.

But the problem is that, when I reload the page, the requests start raining again, instead of loading the cached images. This happens when I navigate to my page and when I reload it, but when I open another page and press back the images are loaded from the cache. When I dynamically add new content with JavaScript the images are loaded from the cache as well.

So, what am I missing? I am using XAMPP server on windows 10 to test.

P.S. I am reloading with the reload button near the address bar, not with Ctrl+R or other key combination that cleans the cache.

P.P.S. To clarify before someone comments on that, I am not downloading all those thousands of images at once

us flag
What do the HTTP caching headers contain for these images?
Nikolai Frolov avatar
in flag
age 10898 cache-control public, max-age=86400, no-transform date Tue, 28 Sep 2021 12:40:50 GMT expires Mon, 27 Sep 2021 16:28:41 GMT
Nikolai Frolov avatar
in flag
so, the images are already expired
us flag
Yes, so you need to increase the `max-age` for these images by adjusting Apache2 configuration.
Nikolai Frolov avatar
in flag
So, I need to fetch those images through my server first. Thanks a lot, I haven't realized youtube does that. Post as answer so I can accept it please, or I will in few days.
Score:1
us flag

Since the HTTP Response caching headers specify a Max-Age of 86400 seconds (one day), the browsers will fetch the images when they expire.

You need to increase the Max-Age to get them cached indefinitely.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.