Quote:
Originally Posted by Gabethebabe
Let's put my abilities into perspective. About 1 month ago I started watching Youtube tutorials about HTML, CSS and Javascript and with the knowledge gained and websites like W3schools, I created word500.com. I had never coded an HTML page, styled a page or wrote Javascript before in my life. So your writing above is 90% Japanese to me
In that case if you're running into refresh/update problems with trying to cache a 600k file, I wouldn't worry about it and just remove the cache entirely. 600k isn't that big, and modern browsers are smart enough to cache files that haven't been updated.
FYI - when you do a "soft refresh", the browser first checks with the server to see if a cached file that it thinks is static (IE .txt, .js, .css, etc.) is stale (again this is automatic, you don't have to do anything). To do this, the browser sends an "If-Modified-Since" request header to the server with the timestamp of the file in its cache. If the file on the server is older or the same age as specified in the request header, the server returns a response with no content and a 304 status code. This tells the browser that it's ok to just use the file it has in its cache.
http://jessesnet.com/development-not...caching-part1/
This might even be the problem you're running into. If you try to replace a static file with one with an older timestamp (which can happen), the browser can sometimes get confused and not load the new (older timestamp file). Check the network tab in Chrome dev tools and look for 304 responses.
I think most browsers and servers handle the problem of older timestamps with unique file IDs now. Then again after working with AWS for years I wouldn't be surprised if cloudfront doesn't do that. Cloudfront to host a website, or S3, is really kind of a kluge. Ideally you'd want something like nginx or apache. But that's a pain to maintain especially for a small site.
Last edited by suzzer99; 04-14-2022 at 12:01 PM.