It wasn't obvious for me how to make HTTPS calls with
Finagle so I'd like to share key points here:
- When building client: explicitly specify correct port (typically 443 instead of 80)
- When building client: enable TLS using ClientBuilder.tls(...) or ClientBuilder.tlsWithoutValidation() method
- When making actual call: specify HTTPS protocol in requested URL
In practice you'll get something like this:
val client = ClientBuilder()
.codec(Http())
.hosts("yourServer:443")
.tls("yourServer")
.build()
val httpRequest = RequestBuilder().url("https://yourServer/somePath").buildGet
val responseFuture = client(httpRequest)
//handle result
For more details about Finagle itself refer to official documentation: