# Curl -X GET http://localhost:9200 returns Access Denied

**URL:** <https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-returns-access-denied/308687>\
**Category:** Elasticsearch\
**Created:** [July 1, 2022, 7:08pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-returns-access-denied/308687 "2022-07-01T19:08:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alaa\_Omar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alaa_omar/32/107822_2.png) [@Alaa\_Omar](https://discuss.elastic.co/u/Alaa_Omar)\
**Post date:** [July 1, 2022, 7:08pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-returns-access-denied/308687/1 "2022-07-01T19:08:29Z")

</div>

am trying to install and setup Elasticsearch 8 on Centos 7 server, the service started but when I do `curl -x GET HTTP://localhost:9200` , or `curl -x GET HTTP://127.0.0.1:9200` or `curl -x GET HTTP://(local IP of the host):9200` , the return is like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e2266685d1a96e00f50daaa13a00067434bb568b.png)  
In elastisearch.yml Uncomment the following lines and change the value for each line as below.

```auto
#network.host:(Your IP address)
#http.port: 9200
#node.name: node-1 (or preferred name)
#cluster.initial_master_nodes: node-1 (or preferred name).

```

The firewall service is disabled.

The squid file configuration :

```auto
#
# Recommended minimum configuration:
#

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

#
# Recommended minimum Access Permission configuration:
#
# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 3128

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

#
# Add any of your own refresh_pattern entries above these.
#
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320

```

How can I solve this problem and get Elastisearch work?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 3, 2022, 11:09pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-returns-access-denied/308687/2 "2022-07-03T23:09:32Z")

</div>

Welcome to our community! 😃

Does it work without squid in the way?

---

<div class="post-metadata">

**Author:** ![Alaa\_Omar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alaa_omar/32/107822_2.png) [@Alaa\_Omar](https://discuss.elastic.co/u/Alaa_Omar)\
**Post date:** [July 4, 2022, 6:35pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-returns-access-denied/308687/3 "2022-07-04T18:35:03Z")

</div>

no it does not

---

<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:** [August 1, 2022, 6:35pm UTC](https://discuss.elastic.co/t/curl-x-get-http-localhost-9200-returns-access-denied/308687/4 "2022-08-01T18:35:04Z")

</div>

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