Proxy supportΒΆ
sttp library by default checks for your System proxy properties (docs):
Following settings are checked:
socksProxyHost
andsocksProxyPort
(default: 1080)http.proxyHost
andhttp.proxyPort
(default: 80)https.proxyHost
andhttps.proxyPort
(default: 443)
Settings are loaded in given order and the first existing value is being used.
Otherwise, proxy values can be specified manually when creating a backend:
import sttp.client._
implicit val backend = HttpURLConnectionBackend(
options = SttpBackendOptions.httpProxy("some.host", 8080))
basicRequest
.get(uri"...")
.send() // uses the proxy
Or in case your proxy requires authentication (supported by the JVM backends):
import sttp.client._
SttpBackendOptions.httpProxy("some.host", 8080, "username", "password")