Skip to content

LDStreamingMode.streaming incompatible with some Proxy servers #406

@swhitty

Description

@swhitty

Describe the bug
LDStreamingMode.streaming can cause start() / setOnline(true) to timeout behind some proxy servers.

We observe that 2% of our customers appear to be behind proxy servers that cause this issue. While cached flags values are available, falling back to polling mode is more reliable for these users.

To reproduce

Add device to a network with an incompatible proxy server and attempt start in streaming mode (which is default):

var config = LDConfig(mobileKey: "")
config.startOnline = false
config.streamingMode = .streaming
LDClient.start(config: config, context: context, startWaitSeconds: 5) { timedOut in
   ...
}

Request is sent to https://clientstream.launchdarkly.com and headers are returned but no data is ever received within the body, timeout occurs and completion handler is called.

Expected behavior
It would be great to detect this and switch to polling somehow.

It's unclear how one could try with streaming then fall back to polling. Its possible to use CFNetworkCopyProxiesForURL to detect upfront if the config.streamingURL will be handled via a proxy, this

Logs
If applicable, add any log output related to your problem.

Library version
9.8.2

XCode and Swift version
Xcode 15.4 Swift 5.10

Platform the issue occurs on
iOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions