# Curl request returns "Missing kbn-version header"

**URL:** https://discuss.elastic.co/t/curl-request-returns-missing-kbn-version-header/50591
**Category:** Kibana
**Created:** [May 20, 2016, 5:55pm UTC](https://discuss.elastic.co/t/curl-request-returns-missing-kbn-version-header/50591 "2016-05-20T17:55:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bonatakis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bonatakis/32/6164_2.png) [@bonatakis](https://discuss.elastic.co/u/bonatakis)
#### Post date: [May 20, 2016, 5:55pm UTC](https://discuss.elastic.co/t/curl-request-returns-missing-kbn-version-header/50591/1 "2016-05-20T17:55:48Z")

</div>

i try to make a request to elasticsearch with curl to the kibana interface.  
`curl -u user:password -i https://ip:5601/elasticsearch/_search?pretty -d '{ "aggs": { "allhosts": {"terms": {"field":"host", "size":30 } } } }'`

the response of the above is

```
> HTTP/1.1 400 Bad Request
> Date: Fri, 20 May 2016 17:40:38 GMT
> Server: Apache/2.4.10 (Debian)
> kbn-name: kibana
> kbn-version: 4.5.0
> content-type: application/json; charset=utf-8
> cache-control: no-cache
> content-length: 79
> Connection: close

> {"statusCode":400,"error":"Bad Request","message":"Missing kbn-version header"}

```

Elasticsearch version is 2.3.2.  
the ip is the vip of the cluster.

The query works pretty fine if I ssh to the node which run the elasticsearch. Any idea what s possible wrong?

---

<div class="post-metadata">

### Author: ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)
#### Post date: [May 20, 2016, 6:10pm UTC](https://discuss.elastic.co/t/curl-request-returns-missing-kbn-version-header/50591/2 "2016-05-20T18:10:57Z")

</div>

Kibana expects the header 'kbn-version' to be passed on requests, it's used to protect against xsrf attacks.

adding `-H kbn-version:4.5.0` should get around that error.

---

<div class="post-metadata">

### Author: ![bonatakis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bonatakis/32/6164_2.png) [@bonatakis](https://discuss.elastic.co/u/bonatakis)
#### Post date: [May 24, 2016, 1:46pm UTC](https://discuss.elastic.co/t/curl-request-returns-missing-kbn-version-header/50591/3 "2016-05-24T13:46:55Z")

</div>

i tried that and surprisely i get another odd respond. it is a 404 http status but I can ensure you that the the path is right

---

<div class="post-metadata">

### Author: ![bonatakis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bonatakis/32/6164_2.png) [@bonatakis](https://discuss.elastic.co/u/bonatakis)
#### Post date: [May 24, 2016, 1:53pm UTC](https://discuss.elastic.co/t/curl-request-returns-missing-kbn-version-header/50591/4 "2016-05-24T13:53:19Z")

</div>

i think it has been solved. thanks jbudz.

curl -u kibana:$pw -H "kbn-version: 4.5.0" https://:5601$host/elasticsearch/\*/\_search?pretty -d '{"query":{"match":{"type":"cinder"}}}' -i

HTTP/1.1 200 OK  
Date: Tue, 24 May 2016 13:43:01 GMT  
Server: Apache/2.4.10 (Debian)  
content-type: application/json; charset=UTF-8  
content-length: 16665  
kbn-name: kibana  
kbn-version: 4.5.0  
cache-control: no-cache

---

<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/curl-request-returns-missing-kbn-version-header/50591/5 "2017-07-06T13:52:25Z")

</div>


