Skip to content

USE CASE / DEVICES & TOOLS

Android proxy workflows

On Android, validate the traffic of the actual application rather than assuming a Wi-Fi proxy setting covers the whole device.

In this guide

WORKFLOW SNAPSHOT

  • Compare an authorized browser check and a specific app request on the same network.
  • Suggested starting behavior: Static assignment
  • Validate the real application and destination

A practical Android workflow

Compare an authorized browser check and a specific app request on the same network.

  • Record device version, network, app, and proxy configuration scope.
  • Verify an observed exit in the browser used for the test.
  • Check app support separately before interpreting a direct connection as a proxy failure.

Which Android app is actually using the proxy setting?

Keep the assignment stable while testing one Android client. A Wi-Fi proxy configuration can be honored differently by browsers, libraries and native applications. Verify the observed exit from the app that performs the work rather than relying on a different browser.

What should you verify on Wi-Fi and app traffic before more tests?

Apps can use their own networking stacks or ignore a configured proxy. Cellular traffic and a Wi-Fi browser test may not follow the same route.

Keep the active network explicit and repeat the test after switching between Wi-Fi and cellular connectivity.

Verify the Android connection boundary

Record Android version, app version, active Wi-Fi or mobile network and the configuration source. A network switch can change both the route and authentication context, so treat it as a separate scenario.

Create an Android browser-and-app route control

Fetch the shared diagnostic resource through this script's proxy so its HTTP outcome can be compared with separately observed Android client requests.

  1. 01
    Generate your endpoint

    Choose HTTP / HTTPS and Sticky session for the complete workflow in Configure proxies.

  2. 02
    Set your proxy URL

    Set PS_PROXY_URL to http://USERNAME:PASSWORD@HOST:PORT using your generated endpoint. For IP authentication, whitelist your machine and use http://HOST:PORT. Percent-encode special characters in credentials; these are proxy credentials, separate from your account password or API key.

  3. 03
    Choose the destination

    Set PS_TARGET_URL before running the code. Use a small HTTPS diagnostic page you control that can be requested from the Android browser and, where supported, the app being tested; include a stable non-sensitive response marker.

    Example URL · replace placeholders with your targethttps://example.com/qa/android/network-control

    Set PS_EXPECT_TEXT to a stable marker deliberately returned by the shared diagnostic page. This optional check inspects the returned text without running JavaScript.

ps_android.pyFetch the shared diagnostic resource through this script's proxy so its HTTP outcome can be compared with separately observed Android client requests.
Before you runPython 3.10+ · python -m pip install requests · python ps_android.py
# Fetch the shared diagnostic resource through this script's proxy so its HTTP outcome can be compared with separately observed Android client requests.
# Set PS_TARGET_URL to a small HTTPS diagnostic page you control that can be requested from the Android browser and, where supported, the app being tested; include a stable non-sensitive response marker.
import hashlib
import json
import os
import time
from pathlib import Path
from urllib.parse import urlsplit

import requests

class InspectSession(requests.Session):
    # Leave redirect bodies streamed instead of preparing the next request.
    def resolve_redirects(self, *args, **kwargs):
        return iter(())

proxy = os.environ["PS_PROXY_URL"]  # HTTP endpoint from ProxySight
target = os.environ["PS_TARGET_URL"]  # https://example.com/qa/android/network-control
if urlsplit(proxy).scheme != "http":
    raise ValueError("Use your generated HTTP proxy endpoint for this example.")
if urlsplit(target).scheme not in ("http", "https"):
    raise ValueError("PS_TARGET_URL must be an HTTP or HTTPS URL.")

with InspectSession() as client:
    client.trust_env = False  # No ambient proxy, NO_PROXY or netrc overrides
    started = time.monotonic()
    with client.get(
        target,
        proxies={"http": proxy, "https": proxy},
        headers={"Accept-Language": "en-US,en;q=0.9"},
        timeout=(10, 20), allow_redirects=False, stream=True,
    ) as response:
        body = bytearray()
        for chunk in response.iter_content(16384):
            body.extend(chunk)
            if len(body) > 1048576:
                raise RuntimeError("Response exceeds this example's 1 MiB limit.")
        Path("android-client-route-control.html").write_bytes(body)
        print(json.dumps({
            "workflow": "android", "status": response.status_code,
            "elapsed_ms": round((time.monotonic() - started) * 1000),
            "bytes": len(body), "sha256": hashlib.sha256(body).hexdigest(),
            "headers": {name: response.headers.get(name) for name in ['Content-Type', 'Location', 'Server']},
        }, indent=2))
        expected = os.getenv("PS_EXPECT_TEXT", "")
        if expected:
            text = body.decode(response.encoding or "utf-8", errors="replace")
            print("Expected text:", "found" if expected in text else "absent")
        # A 200 status alone does not prove the intended page was returned.
        # Inspect redirects, login prompts, 403 and 429 before another request.
Understand the result

Compare status and the known body marker for each client on the same network; this script configures only its own request, so it does not set Android Wi-Fi proxies, prove an app honors them or cover cellular traffic after a network switch.

Response bodies are limited to 1 MiB for a small diagnostic. TLS verification stays enabled; redirects are left for you to inspect. Connection guide

Example: check browser and app coverage on one network

Record the Android version, active network, and exact app involved. Run a non-sensitive browser check first, then test the permitted app scenario separately. Keep the network unchanged between those two observations.

After switching from Wi-Fi to cellular, treat the new context as a fresh test. A result from the earlier network should not silently be carried forward.

Illustrative observation record · replace with your test data
{
  "os_version": "RECORD_ANDROID_VERSION",
  "network": "WIFI_OR_CELLULAR",
  "browser_exit": "RECORD_EXIT",
  "app_coverage": "VERIFIED_OR_UNKNOWN"
}

Android verification checklist

For this Android workflow, record network, browser and native app alongside the actual result. Use the evidence below to decide whether another observation is comparable before increasing the workload.

CheckpointHold constant or recordExpected evidence
NetworkWi-Fi or cellularActive context known
BrowserObserved exit in that browserBrowser path verified
Native appIts supported settings and resultCoverage verified independently

Troubleshoot Android results and connection errors

SymptomCheck nextWhat the result tells you
Browser proxied, app directCheck app networking supportSettings are not universally applied
Works only on Wi-FiCompare configuration scopeNetwork switch changed the context
Authentication differsCheck credentials and public egressThe gateway may see another source

Compare Android browser and app results on the same network

Run one browser diagnostic and one small authorized app request with the same network conditions. Record exits or errors separately. If only the browser changes route, investigate the app’s supported configuration instead of repeatedly changing the gateway settings.

A LITTLE CLARITY

Common questions.

Does an Android Wi-Fi proxy route every app?

Do not assume universal coverage; verify each application and connection type.

When should an Android route be verified again?

After changing network, client, app configuration, or other conditions that can alter which settings the request uses.

What should you verify on Wi-Fi and app traffic before more tests?

Record Android version, app version, active Wi-Fi or mobile network and the configuration source. A network switch can change both the route and authentication context, so treat it as a separate scenario.

PUT THE KNOWLEDGE TO WORK

Your workflow.
Your next connection.

Try the controls, choose your IP behavior, and start with one clear connection check.

Explore the configurator ↗