# Curl -X GET 'http://localhost:9200' curl: (52) Empty reply from server

**URL:** <https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211>\
**Category:** Elasticsearch\
**Created:** [April 3, 2023, 1:07pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211 "2023-04-03T13:07:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adarsh\_R\_K](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adarsh_r_k/32/119361_2.png) [@Adarsh\_R\_K](https://discuss.elastic.co/u/Adarsh_R_K)\
**Post date:** [April 3, 2023, 1:07pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/1 "2023-04-03T13:07:12Z")

</div>

elasticsearch service is active and running but got this error while accessing 9200, elasticsearch.yml file is properly configuredcurl -X GET '[http://localhost:9200](http://localhost:9200)' curl: (52) Empty reply from server

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [April 3, 2023, 2:43pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/2 "2023-04-03T14:43:15Z")

</div>

Hi @Adarsh_R_K Welcome to the community!

What version?

How did you install?

Did you try.

`curl -k -u elastic:password https://localhost:9200`

---

<div class="post-metadata">

**Author:** ![Adarsh\_R\_K](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adarsh_r_k/32/119361_2.png) [@Adarsh\_R\_K](https://discuss.elastic.co/u/Adarsh_R_K)\
**Post date:** [April 4, 2023, 4:12am UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/3 "2023-04-04T04:12:57Z")

</div>

I am using the 8.7 version  
installed through curl command  
I put _"xpack.security.enabled: false"_ in elasticsearch.yml file and it worked, may I know this is the correct solution.  
Thanks

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [April 4, 2023, 4:17am UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/4 "2023-04-04T04:17:07Z")

</div>

> [@Adarsh\_R\_K](#):
>
> installed through curl command

I'm not quite sure what you mean by that

> [@Adarsh\_R\_K](#):
>
> I put _"xpack.security.enabled: false"_ in elasticsearch.yml file and it worked, may I know this is the correct solution

It's a solution if you do not want any security.

If you do want security, start over and follow the documents.

---

<div class="post-metadata">

**Author:** ![Adarsh\_R\_K](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adarsh_r_k/32/119361_2.png) [@Adarsh\_R\_K](https://discuss.elastic.co/u/Adarsh_R_K)\
**Post date:** [April 4, 2023, 4:29am UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/5 "2023-04-04T04:29:40Z")

</div>

Ohk got it  
Thanks

---

<div class="post-metadata">

**Author:** ![vijaykallur](https://avatars.discourse-cdn.com/v4/letter/v/3ec8ea/32.png) [@vijaykallur](https://discuss.elastic.co/u/vijaykallur)\
**Post date:** [April 4, 2023, 12:07pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/6 "2023-04-04T12:07:34Z")

</div>

Hi @Adarsh_R_K

1. If you set these options true in elasticsearch.yml. You can Set the password elasticsearch and all other.  
xpack.security.enabled: true  
xpack.security.transport.ssl.enabled: true

service elasticsearch restart

#command for setting up password  
./elasticsearch-setup-passwords interactive

Initiating the setup of passwords for reserved users elastic,apm\_system,kibana,kibana\_system,logstash\_system,beats\_system,remote\_monitoring\_user.  
You will be prompted to enter passwords as the process progresses.  
Please confirm that you would like to continue [y/N]y

Enter password for [elastic]:  
Reenter password for [elastic]:

later u can do  
curl -X GET "[http://username:password@localhost:9200](http://username:password@localhost:9200)

Output look like

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/1/21bb3e893675fd0658b23de6911da9f31b94ff9c.png)

---

<div class="post-metadata">

**Author:** ![Adarsh\_R\_K](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adarsh_r_k/32/119361_2.png) [@Adarsh\_R\_K](https://discuss.elastic.co/u/Adarsh_R_K)\
**Post date:** [April 4, 2023, 12:13pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/7 "2023-04-04T12:13:49Z")

</div>

In this case how can i configure the username and password in the java client libarary  
help is much appreciated.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 4, 2023, 12:49pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/8 "2023-04-04T12:49:59Z")

</div>

> **[Basic authentication | Elasticsearch Java API Client \[8.7\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_basic_authentication.html)**

---

<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 2, 2023, 12:50pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-curl-52-empty-reply-from-server/329211/9 "2023-05-02T12:50:31Z")

</div>

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