Handle unresolvable domain names in isSecure to allow HTTP proxies to work as expected

Fixes #9708 
Replaces #9728 

Ping @kdomanski @unclejack @ewindisch @dmp42 @dkjer @dmcgowan