# Kibana not compressing HTTP responses

**URL:** <https://discuss.elastic.co/t/kibana-not-compressing-http-responses/266989>\
**Category:** Kibana\
**Created:** [March 11, 2021, 6:28pm UTC](https://discuss.elastic.co/t/kibana-not-compressing-http-responses/266989 "2021-03-11T18:28:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![juan.domenech](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan.domenech/32/142257_2.png) [@juan.domenech](https://discuss.elastic.co/u/juan.domenech)\
**Post date:** [March 11, 2021, 6:28pm UTC](https://discuss.elastic.co/t/kibana-not-compressing-http-responses/266989/1 "2021-03-11T18:28:29Z")

</div>

Recently I've updated to Kibana 7.11.1 and I've noticed slow performance specially in Discover when many documents are returned.

After some investigation I've noticed that **Kibana is no longer compressing the response of queries**. My browser is providing `Accept-Encoding: gzip, deflate` but Kibana seems to be ignoring that. The `Content-Encoding` header is missing:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/2/624827f5f061d3e020e70dce62aa76e55491593e.png)

Interestingly, this is not the behaviour Kibana has with other types of documents like `status`:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/4/849dcd40b5bdae3bae3590df9d5eba86638cfc3f.png)

I've forced compression in the configuration ([although the default is true](https://www.elastic.co/guide/en/kibana/7.11/settings.html))

`server.compression.enabled: true`

but the situation is the same.

Any ideas?

Thanks!  
Juan

---

<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:** [March 17, 2021, 4:56pm UTC](https://discuss.elastic.co/t/kibana-not-compressing-http-responses/266989/2 "2021-03-17T16:56:08Z")

</div>

Hi, it looks like you may have found a bug. Can you please file an issue in our tracker at [https://github.com/elastic/kibana/issues/new](https://github.com/elastic/kibana/issues/new)

As another demonstration, can you try using `curl -i` to send a request directly to the Kibana server (make sure the request is not hitting a proxy) and show the response headers?

---

<div class="post-metadata">

**Author:** ![juan.domenech](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan.domenech/32/142257_2.png) [@juan.domenech](https://discuss.elastic.co/u/juan.domenech)\
**Post date:** [March 18, 2021, 10:04pm UTC](https://discuss.elastic.co/t/kibana-not-compressing-http-responses/266989/3 "2021-03-18T22:04:59Z")

</div>

Thanks for your answer.

I don't know how to construct a full `/internal/bsearch` request using **curl** (Kibana expects session headers...)

But I'll give it a try.

---

<div class="post-metadata">

**Author:** ![juan.domenech](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan.domenech/32/142257_2.png) [@juan.domenech](https://discuss.elastic.co/u/juan.domenech)\
**Post date:** [March 18, 2021, 10:49pm UTC](https://discuss.elastic.co/t/kibana-not-compressing-http-responses/266989/4 "2021-03-18T22:49:09Z")

</div>

OK. I think I have it. I've used `-v` that shows all the headers in both directions to be sure.

I ask for gzipped content (`/internal/bsearch`) but it does not come back that way:

```
# curl -s -v -u elastic:elastic -XPOST 'localhost:5601/internal/bsearch' -H 'Content-Type: application/json' -H 'Accept-Encoding: gzip, deflate' -H 'kbn-xsrf: kibana' -d '{"batch":[{"request":{"params":{"index":"logs*:*","body":{"version":true,"size":500,"sort":[{"@timestamp":{"order":"desc","numeric_type":"date","unmapped_type":"boolean"}}],"aggs":{"2":{"date_histogram":{"field":"@timestamp","fixed_interval":"30s","time_zone":"Europe/Dublin","min_doc_count":1}}},"fields":[],"script_fields":{},"stored_fields":["*"],"_source":{"excludes":[]},"query":{"bool":{"must":[],"filter":[{"match_all":{}},{"range":{"@timestamp":{"gte":"2021-03-18T21:46:39.629Z","lte":"2021-03-18T22:01:39.629Z","format":"strict_date_optional_time"}}}],"should":[],"must_not":[]}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"*":{}},"fragment_size":2147483647}},"preference":1616104872586}},"options":{"strategy":"ese","isStored":false,"isRestore":false}}]}'

* About to connect() to localhost port 5601 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5601 (#0)
* Server auth using Basic with user 'elastic'
> POST /internal/bsearch HTTP/1.1
> Authorization: Basic xxxxxxxxx
> User-Agent: curl/7.29.0
> Host: localhost:5601
> Accept: */*
> Content-Type: application/json
> Accept-Encoding: gzip, deflate
> kbn-xsrf: kibana
> Content-Length: 830
>
* upload completely sent off: 830 out of 830 bytes
< HTTP/1.1 200 OK
< content-type: application/x-ndjson
< connection: keep-alive
< transfer-encoding: chunked
< kbn-name: xxxxxxxxx
< kbn-license-sig: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
< cache-control: private, no-cache, no-store, must-revalidate
< Date: Thu, 18 Mar 2021 22:26:59 GMT
<
{"id":0,"result":{"rawResponse":{"took":133,"timed_out":false,"_shards":{"total":394,"successful":394,"skipped":344,"failed":0},"_clusters":{"total":1,"successful":1,"skipped":0},"hits":{"total":1713499,"max_score":null,"hits":[{...
...
...
...
(10 KBytes of documents)

```

On the other hand, if I ask for a different type of request (like Dev Tools) it comes compressed no problem:

```
# curl -s -v -u elastic:elastic -XPOST 'localhost:5601/api/console/proxy?path=_mapping&method=GET' -H 'Content-Type: application/json' -H 'Accept-Encoding: gzip, deflate' -H 'kbn-xsrf: kibana'

* About to connect() to localhost port 5601 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5601 (#0)
* Server auth using Basic with user 'elastic'
> POST /api/console/proxy?path=_mapping&method=GET HTTP/1.1
> Authorization: Basic xxxxxxxx
> User-Agent: curl/7.29.0
> Host: localhost:5601
> Accept: */*
> Content-Type: application/json
> Accept-Encoding: gzip, deflate
> kbn-xsrf: kibana
>
< HTTP/1.1 200 OK
< warning: 299 Elasticsearch-7.11.1-ff17057114c2199c9c1bbecc727003a907c0db7a "this request accesses system indices: [.async-search, .kibana_task_manager_1, .security-7, .tasks], but in a future major version, direct access to system indices will be prevented by default"
< content-type: application/json; charset=UTF-8
< kbn-name: xxxxxxxx
< kbn-license-sig: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
< cache-control: private, no-cache, no-store, must-revalidate
< vary: accept-encoding
< content-encoding: gzip
< Date: Thu, 18 Mar 2021 22:42:55 GMT
< Connection: keep-alive
< Keep-Alive: timeout=120
< Transfer-Encoding: chunked
<
?e??l?6?I?Q??lR[??$!f?????Z???u?????ͧ/w߫??s'Ȝp????͗?(?VΦ.'H0??U?ӆ]???˯5Ő?vE?uվ?/X?o??z??4Np?8?Wr?_? ?.F?q???c???}?????o??5??+???(+?8u?i\$:?>R_?Xd?с??0&?m?? ??<?#SAY\????#?||O??@a?[???$??͙?Q
>?[?b?i??f?|?F????cu?"?8???f?G]&SY<?A????0?0??>?_?S?'=DK?MI???(N1ي?E??q?Y?i??B???Y?ؘ ????'?&???$ɂ/dۭ??m?7??R??e?hNeS?dd?Sp??m?ژ?????k??Ѳ1??zs|?ז,?0????ӕ?Ѻa$??.?D(?9ӯ.??&GYt?<?K?Vq??K?s3?V"??8
...
...
...

```

Case open: [Kibana not compressing some HTTP responses · Issue #94998 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/94998)

Thanks!

---

<div class="post-metadata">

**Author:** ![juan.domenech](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan.domenech/32/142257_2.png) [@juan.domenech](https://discuss.elastic.co/u/juan.domenech)\
**Post date:** [April 9, 2021, 7:46am UTC](https://discuss.elastic.co/t/kibana-not-compressing-http-responses/266989/5 "2021-04-09T07:46:41Z")

</div>

**Workaround** : In the interim I'm moving the compression layer to Apache.

If you wish to do the same:

#1  
Install **mod\_deflate** and in `/etc/httpd/conf/httpd.conf` add

> LoadModule deflate\_module modules/mod\_deflate.so

#2  
In your virtual host add (Typical file name:`/etc/httpd/conf.d/kibana.conf`)

> SetOutputFilter DEFLATE  
> SetEnvIfNoCase Request\_URI ".(?:gif|jpe?g|png)$" no-gzip

#3  
And disable compression in Kibana. In `/etc/kibana/kibana.yml` add

> server.compression.enabled: false

I'm getting satisfactory results.

---

<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:** [May 7, 2021, 7:46am UTC](https://discuss.elastic.co/t/kibana-not-compressing-http-responses/266989/6 "2021-05-07T07:46:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
