How to run an iPadOS firebase app behind an http proxy?

23 views Asked by At

A client of mine wants to use our iPadOS app behind a proxy. While all normal connections to firebase work, all subscriptions to firestore do not work. The client reported that they can see in the firewall that some connections are bypassing the http proxy (WinGate), and directly use tcp, which is then blocked by the firewall. The connection to the proxy is configured in the iPad settings.

So my question is, whether it is possible to make the subscriptions go through the http proxy or just use http directly, which should already force it to through the proxy. Interestingly, the web version of our app that uses the same firebase backend works without problems. Any pointers are greatly appreciated!

Related issues

1

There are 1 answers

0
Jarno On

I was able to reproduce the problem with the following steps:

  1. Configure the proxy on iOS with an Ethernet connection.
  2. Manually configure a wrong Gateway
  3. Disable the IPv6 DNS entry
  4. Disable Wi-Fi

This way, all traffic has to go through the proxy. A similar setup could be achieved by blocking the iPads IP in the firewall directly.

With this setup, I was not able to make any Firestore subscriptions work.

However, when adding the following code to the AppDelegate

if let proxySettingsUnmanaged = CFNetworkCopySystemProxySettings() {
    let proxySettings = proxySettingsUnmanaged.takeRetainedValue()
    if let ip = (proxySettings as NSDictionary)["HTTPSProxy"] as? String,
        let port = (proxySettings as NSDictionary)["HTTPSPort"] as? Int {
        setenv("grpc_proxy", "http://\(ip):\(port)", 1)
    }
}

the connections are working again. I got the reference for the environment variable grpc_proxy from the grpc rerference.