Will OkHttp Connect Directly When a Proxy Fails?
Use the client version, routing candidates and application retry path to decide whether a failed proxy can lead to direct access.
For the historical system-HTTP-proxy case, OkHttp changed its behavior in 3.5.0: it stopped trying a direct connection after that proxy failed. An older report of silent fallback may describe the behavior before that change.
That history does not settle every application's routing policy. To interpret a report from your own application, follow these three checks:
- Find the resolved OkHttp version. Use the application's dependency information, including the version actually bundled by a framework, rather than the age of the example being copied.
- Find how this client chooses a route. An explicit proxy and a custom ProxySelector are different configurations. If the selector supplies a direct candidate after a proxy, it is offering a direct alternative.
- Follow the failure handler. Look for application code that retries with another client. A direct request made by that replacement is outside the first client's decision.
For a mandatory-proxy requirement, the relevant client policy must stop rather than offer a direct alternative. Check the actual client and retry path against that requirement; the 3.5.0 change alone is not a machine-wide traffic rule.