Proxy

Ktor HTTP client allows using proxy in multiplatform code. The following document describes how to configure a proxy in ktor.

Create proxy

You don’t need to include additional artifacts to create a proxy. The supported proxy types are specific to a client engine. Two types of proxy can be configured in multiplatform: HTTP and .

To create a proxy configuration use builders in the ProxyBuilder factory:

Proxy can be configured in multiplatform code using ProxyConfig builder in HttpClientEngineConfig block:

Platform-specific configuration

Jvm

The ProxyConfig class maps to Proxy class on the jvm:

The most of Jvm client engines support it out of the box.

Note: Apache and CIO engines support HTTP proxy only. Jetty client engine doesn’t support any proxy.

Supported proxy types are engine specific. To see supported URLs consult with engine provider documentation:

  • iOS:

Js

The proxy configuration is unsupported by platform restrictions.