Hello everyone,
I am not sure where this question belongs to: multiplatform or ktor. So I will copy my question here.
I have a question on ktor-server for KMP. I have built a KMP app that I use for testing of Native iOS, Android and Web SDKs. To mock the network I run the ktor server with CIO engines in both Android and iOS apps.
The challenge that I am facing that I can’t combine Web SDKs hosted online with SSL and the local ktor server in iOS app due to strict CORS rules in Safari - mixed content is not allowed.
The solution I see is to enable SSL in ktor server. But the sslConnector method is available only in jvm.
https://api.ktor.io/older/2.3.1/ktor-server/ktor-server-host-common/io.ktor.server.engine/ssl-connector.html
Does anyone know how to enable ssl in ktor server running in iOS and Android?
a
Aleksei Tirman [JB]
07/05/2024, 10:13 AM
Is it feasible to have a single Ktor server on the JVM target for all native tests?
a
adjorno
07/05/2024, 10:15 AM
Not in the setup I have. Each mobile session would require a dedicated JVM instance. The main benefit of running servers directly on the mobile devices is to have an own server that every test can setup with some unique expectations
adjorno
07/05/2024, 10:20 AM
I had a similar problem while was using okhttp MockServer and there I could use a standard Java API to setup SSL. So I don’t think there is any technical blocker to have this functionality extended to Android and iOS.
I just don’t know ktor API to do it.