Hi, I am serving resources such as css or js as follows:
(y.resources-resource/new-resources-resource "public/css/")
(y.resources-resource/new-resources-resource "public/js/")
The problem is with hot code reloading that the cached resources are used instead. When I erase browser cache, everything works fine.@pavel.klavik if you curl
the file, does it send a last modified? is that last modified changing when you change the file?
ya, the modified version is correctly send
I don't know why your browser is ignoring the last modified
If you go into the network tab, maybe you can check what curl it is doing
Ok, so the problem is unrelated to yada. I will have to learn how browser caches work in more detail.
Yada might be broken :) or maybe a combination of both
when I update the css file, the yada response have last modified field updated
Maybe yada should also send max-age
or similar.
Chrome is infamous for an aggressive caching policy, firefox doesn't have this issue iirc.
I don't see it anywhere in the headers
HTTP/1.1 200 OK X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff Content-Type: text/css;charset=utf-8 Last-Modified: Wed, 13 Mar 2019 20:07:38 GMT Server: Aleph/0.4.4 Connection: Keep-Alive Date: Wed, 13 Mar 2019 20:29:44 GMT transfer-encoding: chunked
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control cache-control max-age=0 might tell chrome to send if-last-modified requests, that's the ultimate goal here.
https://stackoverflow.com/questions/11245767/is-chrome-ignoring-cache-control-max-age might be relevant though
so yada should return that as part of the response?
maybe. I'm not sure of enough detail about how chrome/firefox/etc. behave I'm afraid.
what is the easiest way to add max-age in yada?
fork it, do an install, or copy the code into your project and try modifying it until it does what you expect. I think a PR to fix this would be very welcome.
although, for me, the goal is that the cache is used when the file hasn't changed.