Do not cache alarms and info api calls. Extend no-cache headers (#5999)
Chris Akritidis committed
May 13, 2019 at 12:32 UTC
466f0727eb3ac0f8ad4246889ce345a70ba7dc6d
2 files changed
+3
-1
web/api/web_api_v1.c
+2
@@ -208,6 +208,7 @@ inline int web_client_api_request_v1_alarms(RRDHOST *host, struct web_client *w,
208
buffer_flush(w->response.data);
209
w->response.data->contenttype = CT_APPLICATION_JSON;
210
health_alarms2json(host, w->response.data, all);
211
+ buffer_no_cacheable(w->response.data);
212
return 200;
213
}
214
@@ -754,6 +755,7 @@ inline int web_client_api_request_v1_info(RRDHOST *host, struct web_client *w, c
755
buffer_strcat(wb, "\n\t]\n");
756
757
buffer_strcat(wb, "}");
758
+ buffer_no_cacheable(wb);
759
return 200;
760
}
761
web/server/web_client.c
+1
-1
@@ -1006,7 +1006,7 @@ static inline void web_client_send_http_header(struct web_client *w) {
1006
buffer_sprintf(w->response.header_output,
1007
"Cache-Control: %s\r\n"
1008
"Expires: %s\r\n",
1009
- (w->response.data->options & WB_CONTENT_NO_CACHEABLE)?"no-cache":"public",
1009
+ (w->response.data->options & WB_CONTENT_NO_CACHEABLE)?"no-cache, no-store, must-revalidate\r\nPragma: no-cache":"public",
1010
edate);
1011
}
1012