# Access ES in AWS when behind proxy

**URL:** <https://discuss.elastic.co/t/access-es-in-aws-when-behind-proxy/192139>\
**Category:** Elasticsearch\
**Created:** [July 24, 2019, 9:28pm UTC](https://discuss.elastic.co/t/access-es-in-aws-when-behind-proxy/192139 "2019-07-24T21:28:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vreznik](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@vreznik](https://discuss.elastic.co/u/vreznik)\
**Post date:** [July 24, 2019, 9:28pm UTC](https://discuss.elastic.co/t/access-es-in-aws-when-behind-proxy/192139/1 "2019-07-24T21:28:18Z")

</div>

Hi,  
I'm behind proxy and cannot figures out how to access ES from Ajax app. I can access ES in AWS via curl and postman.  
So far I tried:  
final HttpHost httpHost = new HttpHost(host, -1, "https");  
builder = RestClient.builder(new HttpHost(httpHost));  
builder.setHttpClientConfigCallback(httpClientBuilder -\> httpClientBuilder  
.setProxy(new HttpHost("[proxy.mycompany.com](http://proxy.mycompany.com)", 80, "https")));

Also tried to proxy inside IntelliJ

Exception:  
org.apache.http.ConnectionClosedException: Connection closed  
at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:949) ~[elasticsearch-rest-client-6.7.2.jar:6.7.2]  
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:233) ~[elasticsearch-rest-client-6.7.2.jar:6.7.2]  
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1764) ~[elasticsearch-rest-high-level-client-6.7.2.jar:6.7.2]  
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1749) ~[elasticsearch-rest-high-level-client-6.7.2.jar:6.7.2]  
at org.elasticsearch.client.IndicesClient.exists(IndicesClient.java:1087) ~[elasticsearch-rest-high-level-client-6.7.2.jar:6.7.2]

---

<div class="post-metadata">

**Author:** ![vreznik](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@vreznik](https://discuss.elastic.co/u/vreznik)\
**Post date:** [July 25, 2019, 12:18am UTC](https://discuss.elastic.co/t/access-es-in-aws-when-behind-proxy/192139/2 "2019-07-25T00:18:15Z")

</div>

Found the problem - proxy protocol should be http, not https

---

<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 22, 2019, 12:29am UTC](https://discuss.elastic.co/t/access-es-in-aws-when-behind-proxy/192139/3 "2019-08-22T00:29:12Z")

</div>

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