Re: SCNetworkReachability not checking proxy settings in firewalled environment
Re: SCNetworkReachability not checking proxy settings in firewalled environment
- Subject: Re: SCNetworkReachability not checking proxy settings in firewalled environment
- From: Allan Nathanson <email@hidden>
- Date: Thu, 22 May 2014 15:49:10 -0400
> On May 22, 2014, at 2:34 PM, Jens Alfke <email@hidden> wrote:
>
> I’ve written a library that does some fairly complex operations talking to a server via a REST API. I use SCNetworkReachabilityCreateWithName[1] to sign up for notifications when the server becomes reachable, so I’ll know when to kick off this task.
>
> I’ve just gotten a report that this doesn’t work correctly in a particular corporate network. Apparently the entire LAN is firewalled from the outside world, with no external IP addresses directly reachable, and all outside access has to go through an HTTP proxy. (Of some sort; I’m waiting to hear exactly what it is.) In this environment my library never gets notified that the server is reachable so it never kicks off the task. But the device’s proxy settings are correctly configured, so if I _did_ try to connect to the server, it would work.
>
> I suppose I had been assuming that SCNetworkReachability took proxies into account, i.e. if example.com isn’t directly reachable, but there is a proxy in place and the proxy is reachable, then the host should be treated as reachable. Perhaps this was too naïve?
Yup. The SCNetworkReachability API does not take into account proxy configurations.
And, if we did, should we be paying attention to HTTP proxies, HTTPS, .PAC files, ...? To handle proxies, we need more information.
> So is the workaround for me to also use the SystemConfiguration framework to watch for proxy setting changes, and when a proxy is configured start up another observer for the proxy’s reachability?
Yes, if a proxy needs to be used then you really need to check if the proxy server is available vs. the real server.
> Is there any code out there that shows how to do this? (I have to confess that I’m kind of a noob when it comes to proxies, partly because I’ve almost never worked on a network that uses them.)
>
> —Jens
>
> [1]: Here’s my code: https://github.com/couchbase/couchbase-lite-ios/blob/master/Source/CBLReachability.m
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden