Connecting to ES via a http proxy in perl client

I'm trying to connect to my ES via a proxy using a client written in perl.
What's the best way to do this?

Here's what I have, and it works, but I suspect there's a more straight
forward approach:

$e = Search::Elasticsearch->new(
cxn => 'LWP',
nodes => 'node1:9200' );

$ENV{HTTP_proxy} = "http://proxy:3128";
$e->transport->cxn_pool->next_cxn->handle->env_proxy;

--

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/79f08fa4-6bac-4876-8c92-85f3e89a9220%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Kevin

On Friday, 24 October 2014 18:24:00 UTC+2, Kevin Van Workum wrote:

I'm trying to connect to my ES via a proxy using a client written in perl.
What's the best way to do this?

Here's what I have, and it works, but I suspect there's a more straight
forward approach:

$e = Search::Elasticsearch->new(
cxn => 'LWP',
nodes => 'node1:9200' );

$ENV{HTTP_proxy} = "http://proxy:3128";
$e->transport->cxn_pool->next_cxn->handle->env_proxy;

You should be able to do this using the default Cxn backend (HTTP::Tiny).
I haven't tried proxies but, according to the HTTP::Tiny docs, proxies are
supported: HTTP::Tiny - A small, simple, correct HTTP/1.1 client - metacpan.org

This should work:

$ENV{http_proxy} = "http://proxy:3128";
$e = Search::Elasticsearch->new( nodes => 'node1:9200' );

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/453ec592-e3c9-4ff4-8f5a-8e71bab901d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

On Tuesday, October 28, 2014 5:25:29 AM UTC-4, Clinton Gormley wrote:

Hi Kevin

On Friday, 24 October 2014 18:24:00 UTC+2, Kevin Van Workum wrote:

I'm trying to connect to my ES via a proxy using a client written in
perl. What's the best way to do this?

Here's what I have, and it works, but I suspect there's a more straight
forward approach:

$e = Search::Elasticsearch->new(
cxn => 'LWP',
nodes => 'node1:9200' );

$ENV{HTTP_proxy} = "http://proxy:3128";
$e->transport->cxn_pool->next_cxn->handle->env_proxy;

You should be able to do this using the default Cxn backend (HTTP::Tiny).
I haven't tried proxies but, according to the HTTP::Tiny docs, proxies are
supported: https://metacpan.org/pod/HTTP::Tiny#PROXY-SUPPORT

This should work:

$ENV{http_proxy} = "http://proxy:3128";
$e = Search::Elasticsearch->new( nodes => 'node1:9200' );

Yep, that works. Thanks. One can also do this:

$e = Search::Elasticsearch->new ( nodes => 'node1:9200', handle_args => {
proxy => 'http://proxy:3128' } );

--

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0fed1321-7c27-4938-ad80-9a840b7b6fef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.