# Metricbeat, http: server gave HTTP response to HTTPS client

**URL:** <https://discuss.elastic.co/t/metricbeat-http-server-gave-http-response-to-https-client/291835>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [December 14, 2021, 4:06pm UTC](https://discuss.elastic.co/t/metricbeat-http-server-gave-http-response-to-https-client/291835 "2021-12-14T16:06:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahere37](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sahere37](https://discuss.elastic.co/u/sahere37)\
**Post date:** [December 14, 2021, 4:06pm UTC](https://discuss.elastic.co/t/metricbeat-http-server-gave-http-response-to-https-client/291835/1 "2021-12-14T16:06:42Z")

</div>

Hi all,  
I am trying to activate basic security http in my ELK stack. My Elasticsearch version is 7.16.1. I create Elasticsearch-ssl-http.zip and add related files to config folder of Elasticsearch and kibana. Also I add below steps to Elasticsearch.yml:

```auto
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.keystore.path: http.p12

```

and kibana.yml (kibana version is 7.13.1):

```auto
elasticsearch.ssl.certificateAuthorities: C:\ELK\kibana-7.13.1-windows-x86_64\kibana-7.13.1-windows-x86_64\config\elasticsearch-ca.pem

```

When I start elasticserach and kibana, every thing is ok and they are up.  
At the next step, I am trying to do same things in the case of metricbeat, I copy "Elasticsearch-ca.pem" to metricbeat folder and add following to Elasticsearch output of metricbeat.yml:

```auto
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["https://127.0.0.1:9200"]
  indices:
   - index: "metric-%{+yyyy.MM}"
     
  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "**"
  ssl:
    certificate_authorities: ["elasticsearch-ca.pem"]
    verification_mode: "certificate"

```

But, when I start metricbeat, following error has been found:

```auto
2021-12-14T19:28:22.315+0330 ERROR [publisher_pipeline_output] pipeline
/output.go:154 Failed to connect to backoff(elasticsearch(https://127.0.0.1:9200)): Get "https://127.0.0.1:9200": http: server gave HTTP response to HTTPS cl
ient

```

Any advise will be so appreciated.

Regards

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [December 15, 2021, 5:21am UTC](https://discuss.elastic.co/t/metricbeat-http-server-gave-http-response-to-https-client/291835/2 "2021-12-15T05:21:18Z")

</div>

> [@sahere37](#):
>
> ```auto
> output.elasticsearch:
> # Array of hosts to connect to.
> hosts: ["https://127.0.0.1:9200"]
> 
> ```

Could you try with just `hosts: ["127.0.0.1:9200"]` in the config?

---

<div class="post-metadata">

**Author:** ![sahere37](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sahere37](https://discuss.elastic.co/u/sahere37)\
**Post date:** [December 15, 2021, 3:33pm UTC](https://discuss.elastic.co/t/metricbeat-http-server-gave-http-response-to-https-client/291835/3 "2021-12-15T15:33:25Z")

</div>

Dear Kaiyan  
Many thanks for your reply. It works in the case of http but I need to activate tls in the communication between metricbeat and elasticserach and it is needed to use https. I will be so appreciated if you can advice me about this.  
Regards

---

<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:** [January 12, 2022, 5:34pm UTC](https://discuss.elastic.co/t/metricbeat-http-server-gave-http-response-to-https-client/291835/4 "2022-01-12T17:34:09Z")

</div>

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