I'm trying to create an Spray Client for a restful API that is hosted via SSL/TLS. I have that working expect when I'm at work. My company is very security focus so all network traffic goes thru a proxy (I believe this is becoming standard), and the Proxy does SSL inspection (meaning, the SSL connection is made with the proxy and the Proxy does a man-in-the-middle on the session, creating a new certs for the endpoint and all). Never had problem with this (other than setting up the Root CA) for anything running on JVM before. From my googling it appears that Spray does not support SSL via a proxy (does seem odd to me, given most web endpoint have moved to SSL protection).
My question is has this changed, does Spray now fully support Http/HTTPS proxies? If so can I get an example?
object Main extends App with MySslConfiguration{
// we need an ActorSystem to host our application in
implicit val system = ActorSystem("simple-spray-client")
import system.dispatcher // execution context for futures below
val log = Logging(system, getClass)
import SprayJsonSupport._
val proxyHost = "XX.XX.XX.XX"
val proxyPort = 80
IO(Http) ! Http.HostConnectorSetup("www.google.com", 443, sslEncryption = true,connectionType = ClientConnectionType.Proxied(proxyHost, proxyPort))
val pipeline = sendReceive
val responseFuture = pipeline {
Get("https://www.google.com")
}
responseFuture onComplete {
case Success(response) =>
println(response)
shutdown()
case Failure(error) =>
log.error(error, "Couldn't get response")
shutdown()
}