Skip to content

Instantly share code, notes, and snippets.

@thoughtsunificator
Last active January 13, 2025 16:09
Show Gist options
  • Save thoughtsunificator/6f7d9e56b26a652bd18cd96d631714c2 to your computer and use it in GitHub Desktop.
Save thoughtsunificator/6f7d9e56b26a652bd18cd96d631714c2 to your computer and use it in GitHub Desktop.
Setup a native proxy switcher on Firefox
  • Download script.pac to /home/user/script.pac
  • Go to FF network settings and select 'Automatic proxy configuration URL'
  • Enter file:///home/user/script.pac
  • Enjoy

Note: If you're using SOCKS v5 you might want to also select 'Proxy DNS when using SOCKS v5'

Tested on 116.0.2 (64 bit) Arch Linux

function FindProxyForURL(url, host) {
if (
(dnsDomainIs(host, ".my-domain"))
&& !(dnsDomainIs(host, ".other-domain"))
) {
return "SOCKS localhost:2000;"; // SOCKS V5
} else {
return "DIRECT";
}
}
// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file for more information on the syntax.
@thoughtsunificator
Copy link
Author

@thoughtsunificator
Copy link
Author

Good to know: If you enable the automatic detection of settings, Web Proxy Auto-Discovery Protocol will fetch the PAC file it was set up with for all your devices, with the needing to enter the URL every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment