proxy-cleanup-script
Android Proxy Cleanup Script
Purpose
Clear all proxy settings from an Android device via ADB, removing leftover HTTP/HTTPS proxy configurations that may interfere with normal browser/app connectivity.
Prerequisites
- ADB (Android Debug Bridge) installed and in PATH
- Android device connected via USB with USB debugging enabled
ripgrep(rg) available in PATH for filtering
Commands
Full Cleanup Sequence
#!/usr/bin/env bash
set -euo pipefail
adb shell settings delete global http_proxy || true
adb shell settings delete global global_http_proxy_host || true
adb shell settings delete global global_http_proxy_port || true
adb shell settings delete global global_http_proxy_exclusion_list || true
adb reverse --remove-all || true
adb shell am force-stop com.android.chrome || true
echo "Remaining proxy-related globals:"
adb shell settings list global | rg 'proxy' || true
Command Breakdown
| Command | Purpose |
|---|---|
adb shell settings delete global http_proxy |
Remove legacy HTTP proxy setting |
adb shell settings delete global global_http_proxy_host |
Remove proxy hostname |
adb shell settings delete global global_http_proxy_port |
Remove proxy port |
adb shell settings delete global global_http_proxy_exclusion_list |
Remove proxy exclusion list |
adb reverse --remove-all |
Remove all reverse-proxy port mappings |
adb shell am force-stop com.android.chrome |
Force-stop Chrome to clear cached proxy state |
adb shell settings list global | rg 'proxy' |
Verify no proxy settings remain |
Execution
Save as proxy-cleanup.sh:
chmod +x proxy-cleanup.sh
./proxy-cleanup.sh
Expected Output
After cleanup, adb shell settings list global | grep proxy should return only:
global_proxy_pac_url=
This empty PAC URL setting is normal and does not interfere with connectivity.
Use Cases
- After dismantling HTTP interception (Burp, Charles, mitmproxy, etc.)
- Recovering browser connectivity after proxy misconfiguration
- Preparing device for clean network testing
- Debugging "cannot connect to network" issues on mobile
Safety Notes
- The
|| trueclauses prevent script failure if settings do not exist. - Force-stopping Chrome clears its proxy cache but requires the user to reopen the browser.
- Optional: reboot the device after cleanup to fully reset network stack.
Related
See proxy-cleanup-2026-05-22.md for a real-world example and troubleshooting steps.