]> arthur.barton.de Git - netdata.git/commitdiff
attempt to bypass web browser cache for chart data
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Mon, 10 Oct 2016 23:24:39 +0000 (02:24 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Mon, 10 Oct 2016 23:24:39 +0000 (02:24 +0300)
src/web_client.c
web/dashboard.js
web/index.html

index 0cf9eeb6a662daff5156e606aa5ca41730c7875c..2485f20565fd6252f5dcd3c660a67477ff6b601a 100644 (file)
@@ -2210,7 +2210,7 @@ void web_client_process(struct web_client *w) {
     if(w->mode == WEB_CLIENT_MODE_OPTIONS) {
         buffer_strcat(w->response.header_output,
             "Access-Control-Allow-Methods: GET, OPTIONS\r\n"
-            "Access-Control-Allow-Headers: accept, x-requested-with, origin, content-type, cookie\r\n"
+            "Access-Control-Allow-Headers: accept, x-requested-with, origin, content-type, cookie, pragma, cache-control\r\n"
             "Access-Control-Max-Age: 1209600\r\n" // 86400 * 14
             );
     }
index 4fa431d5792087f953533679e9eac65ff9f14bf6..1e42bf2dc7d14ce63a207e9a9218c4781bb101ff 100644 (file)
                 url: this.data_url,
                 cache: false,
                 async: true,
+                headers: {
+                    'Cache-Control': 'no-cache, no-store',
+                    'Pragma': 'no-cache'
+                },
                 xhrFields: { withCredentials: true } // required for the cookie
             })
             .done(function(data) {
                 url: NETDATA.alarms.server + '/api/v1/alarms?' + what.toString(),
                 async: true,
                 cache: false,
+                headers: {
+                    'Cache-Control': 'no-cache, no-store',
+                    'Pragma': 'no-cache'
+                },
                 xhrFields: { withCredentials: true } // required for the cookie
             })
                 .done(function(data) {
                 url: NETDATA.alarms.server + '/api/v1/alarm_log?after=' + last_id.toString(),
                 async: true,
                 cache: false,
+                headers: {
+                    'Cache-Control': 'no-cache, no-store',
+                    'Pragma': 'no-cache'
+                },
                 xhrFields: { withCredentials: true } // required for the cookie
             })
                 .done(function(data) {
                     url: host + '/api/v1/registry?action=hello',
                     async: true,
                     cache: false,
+                    headers: {
+                        'Cache-Control': 'no-cache, no-store',
+                        'Pragma': 'no-cache'
+                    },
                     xhrFields: { withCredentials: true } // required for the cookie
                 })
                 .done(function(data) {
                     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),
                     async: true,
                     cache: false,
+                    headers: {
+                        'Cache-Control': 'no-cache, no-store',
+                        'Pragma': 'no-cache'
+                    },
                     xhrFields: { withCredentials: true } // required for the cookie
                 })
                 .done(function(data) {
                 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),
                 async: true,
                 cache: false,
+                headers: {
+                    'Cache-Control': 'no-cache, no-store',
+                    'Pragma': 'no-cache'
+                },
                 xhrFields: { withCredentials: true } // required for the cookie
             })
                 .done(function(data) {
                 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,
                 async: true,
                 cache: false,
+                headers: {
+                    'Cache-Control': 'no-cache, no-store',
+                    'Pragma': 'no-cache'
+                },
                 xhrFields: { withCredentials: true } // required for the cookie
             })
                 .done(function(data) {
                 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,
                 async: true,
                 cache: false,
+                headers: {
+                    'Cache-Control': 'no-cache, no-store',
+                    'Pragma': 'no-cache'
+                },
                 xhrFields: { withCredentials: true } // required for the cookie
             })
                 .done(function(data) {
index 0847ff1f7b40209fcc649e52ef1b9ce4706be107..1df996038ebba069253872ed366d81b817d99bca 100644 (file)
     </div>
 </body>
 </html>
-<script type="text/javascript" src="dashboard.js?v20161009-1"></script>
+<script type="text/javascript" src="dashboard.js?v20161011-1"></script>