@@ -539,11 +539,17 @@ If you need to pass through an http(s) proxy for connecting to {es}, the client
539
539
out of the box offers a handy configuration for helping you with it. Under the
540
540
hood, it uses the https://github.com/delvedor/hpagent[`hpagent`] module.
541
541
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
+
542
545
[source,js]
543
546
----
547
+ import { HttpConnection } from '@elastic/transport'
548
+
544
549
const client = new Client({
545
550
node: 'http://localhost:9200',
546
- proxy: 'http://localhost:8080'
551
+ proxy: 'http://localhost:8080',
552
+ Connection: HttpConnection,
547
553
})
548
554
----
549
555
@@ -553,11 +559,12 @@ Basic authentication is supported as well:
553
559
----
554
560
const client = new Client({
555
561
node: 'http://localhost:9200',
556
- proxy: 'http:user:pwd@//localhost:8080'
562
+ proxy: 'http:user:pwd@//localhost:8080',
563
+ Connection: HttpConnection,
557
564
})
558
565
----
559
566
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`,
561
568
you can use the `agent` option to configure it.
562
569
563
570
[source,js]
@@ -567,7 +574,8 @@ const client = new Client({
567
574
node: 'http://localhost:9200',
568
575
agent () {
569
576
return new SocksProxyAgent('socks://127.0.0.1:1080')
570
- }
577
+ },
578
+ Connection: HttpConnection,
571
579
})
572
580
----
573
581
0 commit comments