matsluni/aws-spi-akka-http

HTTP Proxy

Closed this issue · 3 comments

At the moment there's no way to set proxy to AkkaHTTP Client via ClientTransport.httpsProxy(proxyAddress). Unfortunately, there's no way to interact with SDK behind a corp proxy.
Have you thought to add this piece in the builder?
Thanks in advance ☺️

Hi Fernando,

thanks for your interest and the request for proxy support. I had a very brief way into this requirement and it looked not really straight forward to me to support this. I will need think about this more.

Also, if you want to try look at it yourself a PR is very welcome.

All the best,
Matthias

I think this is a good feature since some companies require all connections being made by a proxy.

This could be done using the builder:

val proxyHost = "localhost"
val proxyPort = 8888

val httpsProxyTransport = ClientTransport.httpsProxy(InetSocketAddress.createUnresolved(proxyHost, proxyPort))

val settings = ConnectionPoolSettings(system)
  .withConnectionSettings(ClientConnectionSettings(system)
    .withTransport(httpsProxyTransport))

lazy val sdkAsyncHttpClient: SdkAsyncHttpClient =
  AkkaHttpClient
    .builder()
    .withActorSystem(actorSystem)
    .withProxySettings(settings)
    .build()

Soved with #13