Access ES in AWS when behind proxy

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", 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]

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

1 Like

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