I've got an application that is using AppCache to store resources in the browser's cache. I've been able to set up the manifest on a PHP file in order to write automatically all files that must be cached (properly filtered). The headers of this file are the following:
header('Content-Type: text/cache-manifest');
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
It's called appcache.php
and it's referenced correctly in my HTML:
<html manifest="appcache.php">
Everytime I update the manifest, the app detects the update and the events are triggered properly, updating the cache and refreshing the page so they are reloaded.
However, some of the files (mainly Javascript and CSS files) do not refresh properly. Sometimes it takes a few manifest updates (with the whole process), sometimes it takes just one, sometimes it takes forever and I have to delete the browser cache or go Incognito mode.
The app detects the update, so the manifest is not getting catched and it's getting updated correctly. The problem is that, even the files are downloaded again, they are still served in an older version. And the main problem is that this only happens in some files (sometimes they're some css files, sometimes they're js, and so on: the files not updated are random).
Actually, I'm using Chrome v59, and it happens the same on my Android device with Chrome v60.
Is there any explanation to why they're not refreshing correctly? Is this a known bug? Is there anything I can do to solve it?
UPDATE
It seems that it happens the most when I've done some updates with short time between them. After waiting 24h or so, it works at the first try. Maybe this can help you to guess why it happens.
Thank you.