@cryptotaxi247 / netdata-1 / commits / 3d7854df1

attempt to bypass web browser cache for chart data

Costa Tsaousis (ktsaou) committed Oct 11, 2016 at 02:24 UTC 3d7854df1a1764b5e6519442e30d409b8bd1f609
3 files changed +34 -2
src/web_client.c
+1 -1
@@ -2210,7 +2210,7 @@ void web_client_process(struct web_client *w) {
2210 if(w->mode == WEB_CLIENT_MODE_OPTIONS) {
2211 buffer_strcat(w->response.header_output,
2212 "Access-Control-Allow-Methods: GET, OPTIONS\r\n"
2213 - "Access-Control-Allow-Headers: accept, x-requested-with, origin, content-type, cookie\r\n"
2213 + "Access-Control-Allow-Headers: accept, x-requested-with, origin, content-type, cookie, pragma, cache-control\r\n"
2214 "Access-Control-Max-Age: 1209600\r\n" // 86400 * 14
2215 );
2216 }
web/dashboard.js
+32
@@ -2935,6 +2935,10 @@
2935 url: this.data_url,
2936 cache: false,
2937 async: true,
2938 + headers: {
2939 + 'Cache-Control': 'no-cache, no-store',
2940 + 'Pragma': 'no-cache'
2941 + },
2942 xhrFields: { withCredentials: true } // required for the cookie
2943 })
2944 .done(function(data) {
@@ -5926,6 +5930,10 @@
5930 url: NETDATA.alarms.server + '/api/v1/alarms?' + what.toString(),
5931 async: true,
5932 cache: false,
5933 + headers: {
5934 + 'Cache-Control': 'no-cache, no-store',
5935 + 'Pragma': 'no-cache'
5936 + },
5937 xhrFields: { withCredentials: true } // required for the cookie
5938 })
5939 .done(function(data) {
@@ -5970,6 +5978,10 @@
5978 url: NETDATA.alarms.server + '/api/v1/alarm_log?after=' + last_id.toString(),
5979 async: true,
5980 cache: false,
5981 + headers: {
5982 + 'Cache-Control': 'no-cache, no-store',
5983 + 'Pragma': 'no-cache'
5984 + },
5985 xhrFields: { withCredentials: true } // required for the cookie
5986 })
5987 .done(function(data) {
@@ -6096,6 +6108,10 @@
6108 url: host + '/api/v1/registry?action=hello',
6109 async: true,
6110 cache: false,
6111 + headers: {
6112 + 'Cache-Control': 'no-cache, no-store',
6113 + 'Pragma': 'no-cache'
6114 + },
6115 xhrFields: { withCredentials: true } // required for the cookie
6116 })
6117 .done(function(data) {
@@ -6125,6 +6141,10 @@
6141 url: NETDATA.registry.server + '/api/v1/registry?action=access&machine=' + NETDATA.registry.machine_guid + '&name=' + encodeURIComponent(NETDATA.registry.hostname) + '&url=' + encodeURIComponent(NETDATA.serverDefault), // + '&visible_url=' + encodeURIComponent(document.location),
6142 async: true,
6143 cache: false,
6144 + headers: {
6145 + 'Cache-Control': 'no-cache, no-store',
6146 + 'Pragma': 'no-cache'
6147 + },
6148 xhrFields: { withCredentials: true } // required for the cookie
6149 })
6150 .done(function(data) {
@@ -6169,6 +6189,10 @@
6189 url: NETDATA.registry.server + '/api/v1/registry?action=delete&machine=' + NETDATA.registry.machine_guid + '&name=' + encodeURIComponent(NETDATA.registry.hostname) + '&url=' + encodeURIComponent(NETDATA.serverDefault) + '&delete_url=' + encodeURIComponent(delete_url),
6190 async: true,
6191 cache: false,
6192 + headers: {
6193 + 'Cache-Control': 'no-cache, no-store',
6194 + 'Pragma': 'no-cache'
6195 + },
6196 xhrFields: { withCredentials: true } // required for the cookie
6197 })
6198 .done(function(data) {
@@ -6194,6 +6218,10 @@
6218 url: NETDATA.registry.server + '/api/v1/registry?action=search&machine=' + NETDATA.registry.machine_guid + '&name=' + encodeURIComponent(NETDATA.registry.hostname) + '&url=' + encodeURIComponent(NETDATA.serverDefault) + '&for=' + machine_guid,
6219 async: true,
6220 cache: false,
6221 + headers: {
6222 + 'Cache-Control': 'no-cache, no-store',
6223 + 'Pragma': 'no-cache'
6224 + },
6225 xhrFields: { withCredentials: true } // required for the cookie
6226 })
6227 .done(function(data) {
@@ -6219,6 +6247,10 @@
6247 url: NETDATA.registry.server + '/api/v1/registry?action=switch&machine=' + NETDATA.registry.machine_guid + '&name=' + encodeURIComponent(NETDATA.registry.hostname) + '&url=' + encodeURIComponent(NETDATA.serverDefault) + '&to=' + new_person_guid,
6248 async: true,
6249 cache: false,
6250 + headers: {
6251 + 'Cache-Control': 'no-cache, no-store',
6252 + 'Pragma': 'no-cache'
6253 + },
6254 xhrFields: { withCredentials: true } // required for the cookie
6255 })
6256 .done(function(data) {
web/index.html
+1 -1
@@ -3083,4 +3083,4 @@
3083 </div>
3084 </body>
3085 </html>
3086 -<script type="text/javascript" src="dashboard.js?v20161009-1"></script>
3086 +<script type="text/javascript" src="dashboard.js?v20161011-1"></script>