Thanks for that. Unfortunately I need some extra info from you. Please repeat what you just did, but this time include the -showcerts
argument.
Also, I’d like to rule out an ATS issue here. Try this:
-
Create a tiny HTTPS client with Network framework. There’s some code you can use below.
-
Run it against example.com
to confirm that it’s working.
-
Then run it against your server.
Is it able to connect?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
IMPORTANT The following code is for hack-ish testing only. It’s not meant to be a real HTTPS client. HTTP/1.1 is way more complex than this test client suggests.
class TinyHTTPSClient {
init(host: String) {
self.host = host
self.connection = NWConnection(host: .init(host), port: 443, using: .tls)
}
let host: String
let connection: NWConnection
func run() {
let request = """
GET / HTTP/1.1\r
Host: \(self.host)\r
Connection: close\r
\r\n
"""
self.connection.send(content: Data(request.utf8), completion: .contentProcessed({ error in
if let error {
print("did not send, error: \(error)")
} else {
print("did send")
}
}))
self.startReceive()
self.connection.start(queue: .main)
}
func startReceive() {
self.connection.receive(minimumIncompleteLength: 1, maximumLength: 2048) { content, _, isComplete, error in
if let content {
let prefix = (content.prefix(16) as NSData).debugDescription
print("did receive, count: \(content.count), prefix: \(prefix)")
}
if isComplete {
print("did not receive, EOF")
return
}
if let error {
print("did not receive, error: \(error)")
return
}
self.startReceive()
}
}
}