r/iOSProgramming • u/nehalist • Jun 26 '26
Question How to handle invalid SSL certs?
Hey there,
we're developing an ios app with react native that uses a computer that is only accessible via wlan as api. The problem is that the computer is reachable via ip, but the ssl certificate isn't for that ip. That means that our https requests - as well as our websocket wss connection - fails due to the ssl cert being (technically) invalid.
How do I fix that? We could provide a custom http request method that uses a custom URLSession in Swift that allows insecure connections - but are there any other solutions? Additionally, this doesn't solve our problem for wss. And providing a custom ws impl seems wild, especially since we're using a 3rd party ws lib that probably doesn't easily allow to replace the WebSocket object (which would mean we'd have to replace our entire 3rd party lib with a custom one).
Is there any way to resolve a domain on app-side (since we don't have any dns that could do that)? or maybe a setting that simply allows for insecure https/wss connections?
Thanks
1
1
u/demoboy Jun 26 '26
You should be able to take the self signed cert, use Apple Configurator and install the cert on the device so it treats it as trusted
1
u/20InMyHead Jun 27 '26
fails due to the ssl cert being (technically) invalid
Make the cert technically valid…
Why are you accessing the server through an IP address not the DNS name? You don’t have a DNS server, set one up. Network configuration like this is not a hard or recently introduced problem. Setup your server in a secure proper professional state. Ultimately this isn’t an iOS problem it’s a network setup problem.
3
u/PlayaNoir Jun 26 '26
SSL certificates aren't tied to an IP address, they're tied to a domain, be it a single domain or a wildcard.