Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Ubuntu 12.04 and it is running just fine. I only have a problem, I connect to the internet through a proxy at my college, but there are some url's that I don't need the proxy for, so my question is: How can I exempt a url from my proxy configuration on Ubuntu?

share|improve this question

You may need a proxy configuration script (PAC). It is a universal solution, and works in any DE, any platform, with any browser.

In your proxy settings, either in browser, or from Network in Unity, select 'Automatic proxy configuration URL' and type in a path like /home/<Your-user-name>/proxy or some other convinient path.

Open a text editor, ( Search in Dash to find gedit -the default text editor) and write something like this. Save it to the path entered above, when done. Modify to your needs.

function FindProxyForURL(url, host)
// Loopback and localhost goes browser direct always.
    var reip;
    if ((host == "localhost") ||
           (shExpMatch(host, "localhost.*")) ||
           (shExpMatch(host,"10.*")) ||
           (shExpMatch(host,"172.16.*")) || 
           (shExpMatch(host,"192.168.*")) ||
           (shExpMatch(host,"144.16.128.*")) ||
           (host == "")) {
        return "DIRECT";
// Local Sites
    if (dnsDomainIs(host, "") ||
       dnsDomainIs(host, "")) {
        return "DIRECT";
// Test to see if host is an IP address
// Put any ranges you want to skip proxy here.
    reip = /^\d+\.\d+\.\d+\.\d+$/g;
    if (reip.test(host)) {
        if (isInNet(host, "", "") ||
            isInNet(host, "", "") ||
            isInNet(host, "", "") ||
            isInNet(host,"", "")) {
             return "DIRECT";
// Default to proxy.
    return "PROXY <server>:<port>";

As you see, complex configurations can be made out of PAC scripts. The above script skips proxy for any address of type * and * and any ip that matches the ranges. All other requests are routed through proxy server.

P.S: I've seen a empty line at top and bottom in all PAC scripts I've seen so far, so I suggest you add a newline both at top and mottom. Just in case...

share|improve this answer
Additional info here: – Mahesh May 23 '12 at 8:25

If you are just using an http proxy you can open gconf-editor (sudo apt-get install gconf-editor, if you don't have it already) navigate to system:http_proxy and add the urls you want to exempt into the ignore_hosts key, separated by commas I believe. (see picture below)

ignore_hosts key

If you are using a socks5 proxy it's a little more complicated to set system wide. However for certain individual programs it's quite easy. For Firefox for example, go to edit:preferences:advanced:(connection)settings then change it from Use system proxy settings or whatever it is to Manual proxy configuration, then enter your proxy information and add the urls you don't want in the No proxy for field, once again separated by commas. (See screenshot below)

no_proxy_for setting

If you use Chromium you can run it with command line switches, for example /etc/bin/chromium-browser --proxy-bypass-list="localhost,," --proxy-server="socks5://localhost:1080".

Some other applications will have similar functionality, and you can use a wrapper program like tsocks for those that don't.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.