Automatic proxy switching in Firefox

After each installation of Firefox, I always installed the SwitchProxy extension which I found quite useful, as I sometimes am connected directly to the internet, and at other times, when connected through VPN, I am using a proxy. The SwitchProxy extension allows me to choose the correct proxy in a menu bar, so I don't have to go to "Tools->Options->General->Connection Settings" and choose the correct proxy settings.

The problem with that extension, as with all extensions, is that you typically have to reinstall an up-to-date version after a new release of Firefox is out. So I tried to find more information about the syntax and capabilities of the automatic proxy configuration file and found quite useful information in Wikipedia and at Mozilla. Although most documents only describe the http:// URL, it's (of course) also possible to use the file:// URL for the proxy config file. Might be useful if you do not have write access to a web server...

Let the browser find your proxy

Just create a local file /etc/proxy.pac, /home/<username>/cfg/proxy.pac, or C:\\cfg\\proxy.pac (or whatever path you like) in your current operating system environment, and replace the string proxy.domain.xxx:8080 with your specific proxy host name and port:

function FindProxyForURL(url, host) {
   return "PROXY proxy.domain.xxx:8080; DIRECT";
}

Then, enter the following in your Firefox proxy settings, in the line Automatic Proxy Configuration URL:

file:///etc/proxy.pac
or, in Windows:
file:///C:/cfg/proxy.pac
and click "OK". That's all.

BTW - Lots of examples for automatic proxy config files can be found when searching the web for the string "FindProxyForURL"

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

blogfinger

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today