Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an application that needs to change the proxy settings used by Google chrome, then use the browser and then automatically switch back the proxy to what it was.

I have been unable to find where on my Ubuntu system are these settings stored. Its not in the Preferences file for sure. Any ideas on how to go about this task?

share|improve this question
    
Looks like you want to programmatically change the proxy settings. Changing them manually would involve opening up the Preferences section of the Chrome browser. What you want to do seems very strange -- what is the underlying goal of what you're trying to accomplish? There may be a simpler way of achieving that goal. –  Mike Rowave Aug 11 '11 at 13:12
    
May be explaining why I wish to perform such a thing will help people offer alternate solutions. I wish to record all the traffic being served by Google Chrome. For that, I have a client who acts like a proxy server. Now, if I set the proxy of Chrome to localhost and a certain port, all the traffic will go through my client and my client will be able to record all thats happened. And when I am done recording what I need, I will shutdown chrome and restore its original proxy settings. I do not wish to use command line arguments passed onto Chrome browser and wish to do this programmatically. –  Elitecoder Feb 16 '12 at 13:50
add comment

2 Answers

Strubbl's anwser is correct, this is the best solution, since you do not need to keep enabling/disabling system wide proxy settings.

I would add that you should also use this switch in conjunction

--host-resolver-rules="MAP * 0.0.0.0 , EXLUDE 127.0.0.1" 

where 127.0.0.1 is your proxy server. This switch stops chrome from making external dns requests, which when privacy is important will not leak any DNS info.

So the complete command is as follows.

/usr/bin/google-chrome-stable %U --proxy-server="socks5://127.0.0.1:9050" --host-resolver-rules="MAP * 0.0.0.0 , EXLUDE 127.0.0.1"
share|improve this answer
add comment

You can use the Chromium proxy settings from the command line. The man page tells you how. So here is an excerpt from man chromium-browser from my Ubuntu Natty:

   --proxy-server=host:port
          Specify the HTTP/SOCKS4/SOCKS5 proxy server to use for requests.  This overrides any environment variables or settings picked via the options dialog.  An individual
          proxy server is specified using the format:

            [<proxy-scheme>://]<proxy-host>[:<proxy-port>]

          Where <proxy-scheme> is the protocol of the proxy server, and is one of:

            "http", "socks", "socks4", "socks5".

          If the <proxy-scheme> is omitted, it defaults to "http". Also note that "socks" is equivalent to "socks5".

          Examples:

            --proxy-server="foopy:99"
                Use the HTTP proxy "foopy:99" to load all URLs.

            --proxy-server="socks://foobar:1080"
                Use the SOCKS v5 proxy "foobar:1080" to load all URLs.

            --proxy-server="sock4://foobar:1080"
                Use the SOCKS v4 proxy "foobar:1080" to load all URLs.

            --proxy-server="socks5://foobar:66"
                Use the SOCKS v5 proxy "foobar:66" to load all URLs.

          It is also possible to specify a separate proxy server for different URL types, by prefixing the proxy server specifier with a URL specifier:

          Example:

            --proxy-server="https=proxy1:80;http=socks4://baz:1080"
                Load https://* URLs using the HTTP proxy "proxy1:80". And load http://*
                URLs using the SOCKS v4 proxy "baz:1080".

The advantage of using the command line arguments is, that you do not have to change your global system settings.

For example:

$ chromium-browser --proxy-server="http://127.0.0.1:8080"
share|improve this answer
add comment

Your Answer

 
discard

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.