brouter-web icon indicating copy to clipboard operation
brouter-web copied to clipboard

Changes in profiles & cache

Open EssBee59 opened this issue 2 years ago • 3 comments

Hello, today a change in a profile on the server side is not visible in brouter-web bevore a cache expiration (can be very long) or a manual "cache-clear" in the browser. As this behaviour is some times not comfortable, I wanted to discuss a "cache deactivation".

A local test with a minor change in Utils.js was ok using windows-edge ( not tested with other browsers!) BR.Util = { get: function (url, cb) { var xhr = new XMLHttpRequest();
xhr.open('GET', url, true); console.log("setRequestHeader NO CAHE utils.js "); xhr.setRequestHeader("Cache-Control", "no-cache, no-store, must-revalidate"); xhr.onload = function () {

regards EssBee

EssBee59 avatar Jun 30 '23 12:06 EssBee59

I added a no-cache header on the server-side in nginx.conf:

location /brouter/profiles2 { autoindex on; autoindex_localtime on; add_header Cache-Control "no-cache, no-store, must-revalidate"; try_files $uri $uri/ =404; }

It is delivered as expected, not sure yet if it solves the problem, but chances are

abrensch avatar Jul 10 '23 14:07 abrensch

Thanks, I was going to suggest to add this on the server side, as there are other resources we might want to update without a release (e.g. config.js, don't have a definitive list yet), that are requested in different ways, some outside our control.

I think it would be better to remove no-store, as it completely disables caching. Using only no-cache, and maybe must-revalidate as a fallback, should be sufficient, as they always check for a newer version with a small HEAD request first and only use the cache if there isn't one.

nrenner avatar Jul 10 '23 16:07 nrenner

Very good solution Arndt, a retest was successful! But before closing the issue, we could afford to test the change proposed by Norbert? Regards

EssBee59 avatar Jul 10 '23 20:07 EssBee59