Hello everyone, I am not sure where this question ...
# ktor
a
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
Is it feasible to have a single Ktor server on the JVM target for all native tests?
a
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
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.
e
most browsers should treat localhost specially: https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy
is this only a Safari issue?
a
yep. on Android with Chrome it’s fine to mix https and http
This comment describes the situation and the error I am facing https://stackoverflow.com/a/67961406