yada

2019-03-13T19:07:42.026800Z

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.

dominicm 2019-03-13T19:17:00.027400Z

@pavel.klavik if you curl the file, does it send a last modified? is that last modified changing when you change the file?

2019-03-13T19:30:30.027800Z

ya, the modified version is correctly send

dominicm 2019-03-13T19:55:50.028300Z

I don't know why your browser is ignoring the last modified

dominicm 2019-03-13T19:56:05.028800Z

If you go into the network tab, maybe you can check what curl it is doing

2019-03-13T20:07:57.030300Z

Ok, so the problem is unrelated to yada. I will have to learn how browser caches work in more detail.

dominicm 2019-03-13T20:08:20.030700Z

Yada might be broken :) or maybe a combination of both

2019-03-13T20:21:18.031400Z

when I update the css file, the yada response have last modified field updated

dominicm 2019-03-13T20:24:42.031800Z

Maybe yada should also send max-age or similar.

dominicm 2019-03-13T20:24:57.032200Z

Chrome is infamous for an aggressive caching policy, firefox doesn't have this issue iirc.

2019-03-13T20:30:24.032600Z

I don't see it anywhere in the headers

2019-03-13T20:31:05.032800Z

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

dominicm 2019-03-13T20:33:27.033400Z

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.

dominicm 2019-03-13T20:34:52.033700Z

https://stackoverflow.com/questions/11245767/is-chrome-ignoring-cache-control-max-age might be relevant though

2019-03-13T20:40:13.034100Z

so yada should return that as part of the response?

dominicm 2019-03-13T20:43:22.034500Z

maybe. I'm not sure of enough detail about how chrome/firefox/etc. behave I'm afraid.

2019-03-13T20:48:27.034900Z

what is the easiest way to add max-age in yada?

dominicm 2019-03-13T20:50:00.035700Z

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.

dominicm 2019-03-13T20:50:14.036100Z

although, for me, the goal is that the cache is used when the file hasn't changed.