Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in profiles & cache #749

Open
EssBee59 opened this issue Jun 30, 2023 · 3 comments
Open

Changes in profiles & cache #749

EssBee59 opened this issue Jun 30, 2023 · 3 comments

Comments

@EssBee59
Copy link

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

@abrensch
Copy link
Contributor

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

@nrenner
Copy link
Owner

nrenner commented Jul 10, 2023

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.

@EssBee59
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants