Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 8.9] Improve proxy configuration docs (#2035) #2039

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions docs/connecting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,17 @@ If you need to pass through an http(s) proxy for connecting to {es}, the client
out of the box offers a handy configuration for helping you with it. Under the
hood, it uses the https://github.com/delvedor/hpagent[`hpagent`] module.

In versions 8.0+ of the client, the default `Connection` type is set to `UndiciConnection`, which does not support proxy configurations.
To use a proxy, you will need to use the `HttpConnection` class from `@elastic/transport` instead.

[source,js]
----
import { HttpConnection } from '@elastic/transport'

const client = new Client({
node: 'http://localhost:9200',
proxy: 'http://localhost:8080'
proxy: 'http://localhost:8080',
Connection: HttpConnection,
})
----

Expand All @@ -553,11 +559,12 @@ Basic authentication is supported as well:
----
const client = new Client({
node: 'http://localhost:9200',
proxy: 'http:user:pwd@//localhost:8080'
proxy: 'http:user:pwd@//localhost:8080',
Connection: HttpConnection,
})
----

If you are connecting through a not http(s) proxy, such as a `socks5` or `pac`,
If you are connecting through a non-http(s) proxy, such as a `socks5` or `pac`,
you can use the `agent` option to configure it.

[source,js]
Expand All @@ -567,7 +574,8 @@ const client = new Client({
node: 'http://localhost:9200',
agent () {
return new SocksProxyAgent('socks://127.0.0.1:1080')
}
},
Connection: HttpConnection,
})
----

Expand Down
Loading