Browse Source

Do not cache alarms and info api calls. Extend no-cache headers (#5999)

Chris Akritidis 5 years ago
parent
commit
466f0727eb
2 changed files with 3 additions and 1 deletions
  1. 2 0
      web/api/web_api_v1.c
  2. 1 1
      web/server/web_client.c

+ 2 - 0
web/api/web_api_v1.c

@@ -208,6 +208,7 @@ inline int web_client_api_request_v1_alarms(RRDHOST *host, struct web_client *w,
     buffer_flush(w->response.data);
     w->response.data->contenttype = CT_APPLICATION_JSON;
     health_alarms2json(host, w->response.data, all);
+    buffer_no_cacheable(w->response.data);
     return 200;
 }
 
@@ -754,6 +755,7 @@ inline int web_client_api_request_v1_info(RRDHOST *host, struct web_client *w, c
     buffer_strcat(wb, "\n\t]\n");
 
     buffer_strcat(wb, "}");
+    buffer_no_cacheable(wb);
     return 200;
 }
 

+ 1 - 1
web/server/web_client.c

@@ -1006,7 +1006,7 @@ static inline void web_client_send_http_header(struct web_client *w) {
         buffer_sprintf(w->response.header_output,
                 "Cache-Control: %s\r\n"
                         "Expires: %s\r\n",
-                (w->response.data->options & WB_CONTENT_NO_CACHEABLE)?"no-cache":"public",
+                (w->response.data->options & WB_CONTENT_NO_CACHEABLE)?"no-cache, no-store, must-revalidate\r\nPragma: no-cache":"public",
                 edate);
     }