http proxy support

61 views
Skip to first unread message

sub...@gmail.com

unread,
Oct 31, 2016, 6:26:44 PM10/31/16
to Akka User List
I'm interested in proxying http requests with akka-http. Based on what I've read so far I need to enable the configuration and then it should work with Http().singleRequest
however it's not connecting through the proxy. I have the following config in application.conf

akka.http {

host-connection-pool {

  client {

    proxy {

      http {

        host = 127.0.0.1

        post = 8888

      }

    }

  }

}

}


and following code

val responseFuture: Future[HttpResponse] =
Http().singleRequest(HttpRequest(uri = "http://akka.io"))

val response: HttpResponse = Await.result(responseFuture, Duration.Inf)

println(response.status.intValue())

SBT has

libraryDependencies += "com.typesafe.akka" %% "akka-http-core" % "2.4.11"
libraryDependencies += "com.typesafe.akka" %% "akka-http-experimental" % "2.4.11"

André

unread,
Nov 2, 2016, 5:06:10 AM11/2/16
to Akka User List
Hi,

this config was supported in Spray but wasn't yet ported over to akka-http.

> Based on what I've read so far I need to enable the configuration and then it should work with Http().singleRequest
> however it's not connecting through the proxy.

May I ask where you got that info from?

Cheers
André

sub...@gmail.com

unread,
Nov 2, 2016, 9:57:36 AM11/2/16
to Akka User List
http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0/scala/http/configuration.html

also in the 2.4.11 docs but can't find that link at the moment

prior to the client section, under host-connection-pool it says

  1. # Please note that this section mirrors `akka.http.client` however is used only for pool-based APIs,
  2. # such as `Http().superPool` or `Http().singleRequest`.
If that feature is not yet in Akka, is there any solution to get proxy support for use with Akka Streams? For example could I use a Netty or other http implementation and create a Source from that? Thanks!

Marek Tomas

unread,
Jan 18, 2017, 5:48:38 AM1/18/17
to Akka User List
Would be interested in opinion here as well, and clarification whether it works at least for `superPool` or `singleRequest`.

Dňa streda, 2. novembra 2016 14:57:36 UTC+1 sub...@gmail.com napísal(-a):
Reply all
Reply to author
Forward
0 new messages