@cryptotaxi247 / netdata-1 / commits / 549e09ffc

allow cookies on all requests to support running netdata behind an authentication web server

Costa Tsaousis committed Jun 2, 2016 at 19:31 UTC 549e09ffcde5e95a9e44688ed9ff3a0a5d43cee7
1 file changed +30 -15
web/dashboard.js
+30 -15
@@ -581,7 +581,8 @@
581 $.ajax({
582 url: host + '/api/v1/charts',
583 async: true,
584 - cache: false
584 + cache: false,
585 + xhrFields: { withCredentials: true } // required for the cookie
586 })
587 .done(function(data) {
588 if(data !== null) {
@@ -2793,7 +2794,8 @@
2794 this.xhr = $.ajax( {
2795 url: this.data_url,
2796 cache: false,
2796 - async: true
2797 + async: true,
2798 + xhrFields: { withCredentials: true } // required for the cookie
2799 })
2800 .success(function(data) {
2801 if(that.debug === true)
@@ -3013,7 +3015,8 @@
3015 $.ajax( {
3016 url: this.host + this.chart_url,
3017 cache: false,
3016 - async: true
3018 + async: true,
3019 + xhrFields: { withCredentials: true } // required for the cookie
3020 })
3021 .done(function(chart) {
3022 chart.url = that.chart_url;
@@ -3403,7 +3406,8 @@
3406 $.ajax({
3407 url: NETDATA.peity_js,
3408 cache: true,
3406 - dataType: "script"
3409 + dataType: "script",
3410 + xhrFields: { withCredentials: true } // required for the cookie
3411 })
3412 .done(function() {
3413 NETDATA.registerChartLibrary('peity', NETDATA.peity_js);
@@ -3464,7 +3468,8 @@
3468 $.ajax({
3469 url: NETDATA.sparkline_js,
3470 cache: true,
3467 - dataType: "script"
3471 + dataType: "script",
3472 + xhrFields: { withCredentials: true } // required for the cookie
3473 })
3474 .done(function() {
3475 NETDATA.registerChartLibrary('sparkline', NETDATA.sparkline_js);
@@ -3648,7 +3653,8 @@
3653 $.ajax({
3654 url: NETDATA.dygraph_smooth_js,
3655 cache: true,
3651 - dataType: "script"
3656 + dataType: "script",
3657 + xhrFields: { withCredentials: true } // required for the cookie
3658 })
3659 .done(function() {
3660 NETDATA.dygraph.smooth = true;
@@ -3668,7 +3674,8 @@
3674 $.ajax({
3675 url: NETDATA.dygraph_js,
3676 cache: true,
3671 - dataType: "script"
3677 + dataType: "script",
3678 + xhrFields: { withCredentials: true } // required for the cookie
3679 })
3680 .done(function() {
3681 NETDATA.registerChartLibrary('dygraph', NETDATA.dygraph_js);
@@ -4261,7 +4268,8 @@
4268 $.ajax({
4269 url: NETDATA.morris_js,
4270 cache: true,
4264 - dataType: "script"
4271 + dataType: "script",
4272 + xhrFields: { withCredentials: true } // required for the cookie
4273 })
4274 .done(function() {
4275 NETDATA.registerChartLibrary('morris', NETDATA.morris_js);
@@ -4326,7 +4334,8 @@
4334 $.ajax({
4335 url: NETDATA.raphael_js,
4336 cache: true,
4329 - dataType: "script"
4337 + dataType: "script",
4338 + xhrFields: { withCredentials: true } // required for the cookie
4339 })
4340 .done(function() {
4341 NETDATA.registerChartLibrary('raphael', NETDATA.raphael_js);
@@ -4390,7 +4399,8 @@
4399 $.ajax({
4400 url: NETDATA.c3_js,
4401 cache: true,
4393 - dataType: "script"
4402 + dataType: "script",
4403 + xhrFields: { withCredentials: true } // required for the cookie
4404 })
4405 .done(function() {
4406 NETDATA.registerChartLibrary('c3', NETDATA.c3_js);
@@ -4488,7 +4498,8 @@
4498 $.ajax({
4499 url: NETDATA.d3_js,
4500 cache: true,
4491 - dataType: "script"
4501 + dataType: "script",
4502 + xhrFields: { withCredentials: true } // required for the cookie
4503 })
4504 .done(function() {
4505 NETDATA.registerChartLibrary('d3', NETDATA.d3_js);
@@ -4525,7 +4536,8 @@
4536 $.ajax({
4537 url: NETDATA.google_js,
4538 cache: true,
4528 - dataType: "script"
4539 + dataType: "script",
4540 + xhrFields: { withCredentials: true } // required for the cookie
4541 })
4542 .done(function() {
4543 NETDATA.registerChartLibrary('google', NETDATA.google_js);
@@ -4669,7 +4681,8 @@
4681 $.ajax({
4682 url: NETDATA.easypiechart_js,
4683 cache: true,
4672 - dataType: "script"
4684 + dataType: "script",
4685 + xhrFields: { withCredentials: true } // required for the cookie
4686 })
4687 .done(function() {
4688 NETDATA.registerChartLibrary('easypiechart', NETDATA.easypiechart_js);
@@ -4861,7 +4874,8 @@
4874 $.ajax({
4875 url: NETDATA.gauge_js,
4876 cache: true,
4864 - dataType: "script"
4877 + dataType: "script",
4878 + xhrFields: { withCredentials: true } // required for the cookie
4879 })
4880 .done(function() {
4881 NETDATA.registerChartLibrary('gauge', NETDATA.gauge_js);
@@ -5470,7 +5484,8 @@
5484 $.ajax({
5485 url: NETDATA.requiredJs[index].url,
5486 cache: true,
5473 - dataType: "script"
5487 + dataType: "script",
5488 + xhrFields: { withCredentials: true } // required for the cookie
5489 })
5490 .success(function() {
5491 if(NETDATA.options.debug.main_loop === true)