New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how can I connecting my server as HTTPS with using self-signed Certificate file #977
Comments
validateCertificateChain: true, => Change it to false. You should try to ask this kind of questions on stack overflow (as instructed to in the readme). |
I override NSURLSessionDelegate like this below: (validateCertificateChain: true, => Change it to false. is not useful) |
Did you ever figure this out. I had a similar issue and it was caused by my not declaring manager globally. The following declaration of manager fixed it for me:
Also, @dickwu, for future references, I recommend that you to prepend each line of your code with four spaces so that it is easier to read. Doing so is how I achieved the code display that you see above. |
Hi @dickwu, My guess at this point is that you're getting bit by ATS. Here's a few tips:
If you still cannot figure it out, I'd suggest opening a question on Stack Overflow. Best of luck! 🍻 |
I setup up a web server on localhost with self-sign Certificate file, but I can't POST data to the Server over HTTPS.
let serverTrustPolicies: [String: ServerTrustPolicy] = [
"localhost": .PinCertificates(
certificates: ServerTrustPolicy.certificatesInBundle(),
validateCertificateChain: true,
validateHost: true
),
"insecure.expired-apis.com": .DisableEvaluation
]
manager.request(.POST, "https://localhost/index.php", parameters: nil).responseString { (response) -> Void in
print(response.result.value)
}
print result is nil
The text was updated successfully, but these errors were encountered: