# Kibana XMLHttpRequest cannot load header

**URL:** <https://discuss.elastic.co/t/kibana-xmlhttprequest-cannot-load-header/49880>\
**Category:** Kibana\
**Created:** [May 12, 2016, 9:55am UTC](https://discuss.elastic.co/t/kibana-xmlhttprequest-cannot-load-header/49880 "2016-05-12T09:55:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Veer\_Shubhranshu\_Shr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/veer_shubhranshu_shr/32/9530_2.png) [@Veer\_Shubhranshu\_Shr](https://discuss.elastic.co/u/Veer_Shubhranshu_Shr)\
**Post date:** [May 12, 2016, 9:55am UTC](https://discuss.elastic.co/t/kibana-xmlhttprequest-cannot-load-header/49880/1 "2016-05-12T09:55:15Z")

</div>

Hi Kibana Team,

I am developing a Kibana plugin. I am trying to make a AJAX call from Kibana Visualization to external web service. Below is my code:

```
 $.ajax({
     type: "GET",
     url: 'http://localhost/elasticservice',
     headers: {'Content-Type':'application/x-www-form-urlencoded'},
     success: function(result) {
          console.log(result);
     },
     error: function() {
          alert("error");
     },
});

```

On this, I am getting an error in the console:

```
  XMLHttpRequest cannot load http://localhost/elasticservice. Response for preflight is invalid (redirect)

```

Any idea for this error?

---

<div class="post-metadata">

**Author:** ![Khalah\_Jones\_Golden](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khalah_jones_golden/32/7169_2.png) [@Khalah\_Jones\_Golden](https://discuss.elastic.co/u/Khalah_Jones_Golden)\
**Post date:** [May 16, 2016, 7:10pm UTC](https://discuss.elastic.co/t/kibana-xmlhttprequest-cannot-load-header/49880/2 "2016-05-16T19:10:32Z")

</div>

Hmm, after some research, i found [this question](http://stackoverflow.com/questions/33645511/why-my-ajax-showing-preflight-is-invalid-redirect-error) which says your problem is likely due to your use of http as opposed to https.

Peace,  
Khalah

---

<div class="post-metadata">

**Author:** ![Veer\_Shubhranshu\_Shr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/veer_shubhranshu_shr/32/9530_2.png) [@Veer\_Shubhranshu\_Shr](https://discuss.elastic.co/u/Veer_Shubhranshu_Shr)\
**Post date:** [May 17, 2016, 6:22am UTC](https://discuss.elastic.co/t/kibana-xmlhttprequest-cannot-load-header/49880/3 "2016-05-17T06:22:11Z")

</div>

hi Khalah,

I checked the link and couple of more links. I tried with HTTPS but it does'nt work either.

[Here](http://stackoverflow.com/questions/32500073/request-header-field-access-control-allow-headers-is-not-allowed-by-itself-in-pr#answer-32501365), it talks about the same problem. From this link, I understand that the problem with calling the external service is, that the service needs to accept the `preflight` mechanism of Kibana.

So, now I am left with a question, of how to communicate using Kibana `preflight`. And Idea or suggestion on the same?

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [May 20, 2016, 5:27pm UTC](https://discuss.elastic.co/t/kibana-xmlhttprequest-cannot-load-header/49880/4 "2016-05-20T17:27:56Z")

</div>

After you switched to using HTTPS did you get a different error?

Since the browser's communication is with an external service (Cross-Origin), there is an initial OPTIONS request sent to the service. The browser is expecting that the acknowledging response comes from the server. This gives the service control over which domains are allowed to access it and which methods they are allowed to use.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:52pm UTC](https://discuss.elastic.co/t/kibana-xmlhttprequest-cannot-load-header/49880/5 "2017-07-06T13:52:43Z")

</div>


