Configuring a Proxy Auto‑Config (PAC) file lets you define flexible proxy rules—such as directing only certain domains through a proxy while letting the rest go direct. Android supports PAC files for Wi‑Fi networks, but the feature is hidden in the Advanced proxy settings. The steps below work on Android 9 (Pie) and newer; older versions may lack the Auto proxy option.
A PAC file is a plain‑text JavaScript file that returns a proxy string based on the URL being requested. Below is a minimal example that sends all traffic to a proxy at proxy.example.com:8080, except requests to *.example.org, which go direct.
function FindProxyForURL(url, host) {
// Bypass the proxy for internal sites
if (dnsDomainIs(host, ".example.org")) {
return "DIRECT";
}
// All other traffic goes through the proxy
return "PROXY proxy.example.com:8080";
}
Save this text as myproxy.pac. If you need more complex rules, consult the PAC specification, but keep the file under 10 KB for reliable Android parsing.
You have three practical options:
.pac and is served with Content-Type: application/x-ns-proxy-autoconfig or text/plain.pkg install python
python -m http.server 8000 --bind 127.0.0.1
Place myproxy.pac in the directory where you start the server. The URL will be http://127.0.0.1:8000/myproxy.pac. Note that Android can only access the loopback address from the same app, so for a truly local host you need to use the device’s Wi‑Fi IP (e.g., http://192.168.1.42:8000/myproxy.pac).For most users the online host is simplest; just copy the raw file URL.
Open Settings → Network & internet → Wi‑Fi. Tap the gear icon next to the target network (or long‑press and choose Modify network).
In the network edit screen, expand Advanced options. Under Proxy you will see three choices: None, Manual, and Auto. Select Auto.
When Auto is selected, a field labelled Proxy Auto‑Config URL appears. Paste the full URL of your PAC file (e.g., https://gist.githubusercontent.com/username/abcd1234/raw/myproxy.pac).
Tap Save (or the check‑mark) to apply the changes. Android will now download the PAC file and use it for all HTTP/HTTPS traffic on that Wi‑Fi network.
Open a browser and visit whatismyip.com. The site should display the IP address of proxy.example.com if the PAC file is working. To test the bypass rule, open a site under example.org; it should show your real home IP.
Alternatively, use the Android adb shell command to inspect the active proxy:
adb shell settings get global http_proxy
If the command returns proxy.example.com:8080, the proxy portion of the PAC file is being applied. Note that Android does not expose the raw PAC file content via settings, so manual verification via a web service is the most reliable method.
Using a proxy routes all your HTTP/HTTPS traffic through a third‑party server. Even though the PAC file itself does not encrypt data, the underlying connections are still protected by TLS when you visit HTTPS sites. However, the proxy can see the domain names of encrypted connections (via SNI) and the full request URL for unencrypted sites. Only use proxies you trust, and consider adding certificate pinning or a VPN if you need end‑to‑end privacy.
With the steps above you now have a functional system‑wide PAC configuration for your Android Wi‑Fi network, without needing root access. Adjust the PAC rules as your needs evolve, and always verify that traffic is flowing through the intended proxy.









