Hi! I'm trying to write microservice using RxNetty and stuck on implementing HTTPS support for it. I have certificate chain in PEM format and a private key for domain ikeybase.ru, that are already in used in Apache that serves website and in some other services at this domain. I have following code for starting server:
fun start() {
server = HttpServer.newServer(environment.serverConfiguration.port)
environment.serverConfiguration.sslConfiguration.let { ssl ->
if(ssl != null) {
val certFile = File(ssl.certificatePath)
val keyFile = File(ssl.privatePath)
val sslContext = SslContextBuilder.forServer(certFile.inputStream(), keyFile.inputStream())
.sslProvider(SslProvider.JDK)
.clientAuth(ClientAuth.REQUIRE)
.build()
val sslEngine = sslContext.newEngine(UnpooledByteBufAllocator.DEFAULT, "ikeybase.ru", 2228)
server = server.secure(sslEngine)
server.start { httpRequest, httpResponse ->
router.route(httpRequest, httpResponse)
}
} else {
server.start { httpRequest, httpResponse ->
router.route(httpRequest, httpResponse)
}
}
}
}
where ssl.certificatePath is path to PEM ca-bundle and ssl.privatePath is path to private key, converted from *.key file to pk8 format with following command:
After starting server with sslConfiguration defined, server seems to be started normally, however when I'm trying to access any content, nothing happens.
Router.route not called and I got following error at first service query and no output at others, however, when sslConfiguration not defined, server runs
perfectly:
Hi! I'm trying to write microservice using RxNetty and stuck on implementing HTTPS support for it. I have certificate chain in PEM format and a private key for domain ikeybase.ru, that are already in used in Apache that serves website and in some other services at this domain. I have following code for starting server:
where
ssl.certificatePath
is path to PEM ca-bundle andssl.privatePath
is path to private key, converted from *.key file to pk8 format with following command:After starting server with sslConfiguration defined, server seems to be started normally, however when I'm trying to access any content, nothing happens. Router.route not called and I got following error at first service query and no output at others, however, when sslConfiguration not defined, server runs perfectly:
Gradle setup:
How can I use HTTPS certificate and pkey to enable HTTPS support for server side RxNetty? Any help appreciated, thanks in advance!