@@ -539,11 +539,17 @@ If you need to pass through an http(s) proxy for connecting to {es}, the client
539539out of the box offers a handy configuration for helping you with it. Under the
540540hood, it uses the https://github.com/delvedor/hpagent[`hpagent`] module.
541541
542+ In versions 8.0+ of the client, the default `Connection` type is set to `UndiciConnection`, which does not support proxy configurations.
543+ To use a proxy, you will need to use the `HttpConnection` class from `@elastic/transport` instead.
544+
542545[source,js]
543546----
547+ import { HttpConnection } from '@elastic/transport'
548+
544549const client = new Client({
545550 node: 'http://localhost:9200',
546- proxy: 'http://localhost:8080'
551+ proxy: 'http://localhost:8080',
552+ Connection: HttpConnection,
547553})
548554----
549555
@@ -553,11 +559,12 @@ Basic authentication is supported as well:
553559----
554560const client = new Client({
555561 node: 'http://localhost:9200',
556- proxy: 'http:user:pwd@//localhost:8080'
562+ proxy: 'http:user:pwd@//localhost:8080',
563+ Connection: HttpConnection,
557564})
558565----
559566
560- If you are connecting through a not http(s) proxy, such as a `socks5` or `pac`,
567+ If you are connecting through a non- http(s) proxy, such as a `socks5` or `pac`,
561568you can use the `agent` option to configure it.
562569
563570[source,js]
@@ -567,7 +574,8 @@ const client = new Client({
567574 node: 'http://localhost:9200',
568575 agent () {
569576 return new SocksProxyAgent('socks://127.0.0.1:1080')
570- }
577+ },
578+ Connection: HttpConnection,
571579})
572580----
573581
0 commit comments