====== Firefox/Chrome Proxy ======
To use a proxy for specific sites only, the easiest option is to create a pac file and configure Firefox/Chrome to use it as automatic proxy configuration.
Example pac file:
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, "example.com")) {
return "HTTP 192.168.0.1:8888";
}
}
Possible option to identify network to only use proxy if in home network or private ip range:
function FindProxyForURL(url, host) {
var myIP = myIpAddress();
// Detect by IP range (example: 192.168.1.x) or DNS suffix (example: home.lan)
if (
isInNet(myIP, "192.168.1.0", "255.255.255.0") ||
dnsDomainIs(host, ".home.lan")
) {
return "PROXY proxy.example.com:8080";
}
// Otherwise, no proxy
return "DIRECT";
}
Store this somewhere and go to about:preferences -> general -> Network settings (very bottom) -> settings, select "Automatic proxy configuration URL" and enter the path to the pac file in the file protocol notation, e.g.:
file:///home/user/.config/custom_proxies.pac
After making changes to the file, go back to the Firefox proxy configuration URL settings and click reload.
Further info:
[[https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file|Mozilla Dev]]
Chrome/Chromium:
These browsers use the system proxy settings and do not have a GUI option to set custom proxies. Proxies and bypass urls need to be set via command line:
--proxy-server="foopy:8080" --proxy-bypass-list="*.google.com;*foo.com;127.0.0.1:8080"
--proxy-pac-url="http://wpad/windows.pac"