Configuring a system-wide HTTP or SOCKS proxy in Chrome/Chromium

Other than Firefox, Chrome/Chromium uses the system’s proxy settings so in order to route your traffic through a proxy you’ll need to configure it on the system level.

In general the scheme for the proxy URL is user:password@host:port. We assume here that your proxy doesn’t require any credentials. In this case the combination of the host and port number is sufficient. In the following we’ll use 127.0.0.1:9081 for the proxy URL.

Linux

Add the following lines to your ~/.bashrc, or ~/.zshrc respectively.

export http_proxy=http://127.0.0.1:9081
export https_proxy=http://127.0.0.1:9081
export ftp_proxy=http://127.0.0.1:9081

This scenario assumes that your proxy handles all three protocol schemes but you can use a different proxy for each of them.

The above lines could be shortened to one single line.

export all_proxy=http://127.0.0.1:9081

It makes sense to exclude some traffic from being proxied such as all the requests to your local machine in order to access your local web server.

export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

If you want to use more websites unproxied, simply add them comma-separated to the above environment variable.

That’s it, your traffic in Chrome/Chromium goes through the proxy now, except everything local.

Use a SOCKS5 proxy

To use a SOCKS5 proxy with Chromium you need to run it from the CLI by specifying its application parameter --proxy-server as the next example shows. The second parameter specifies to resolve domains remotely.

$ chromium --proxy-server="socks5://127.0.0.1:9081" \
--host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE myproxy"

Either you launch a SOCKS5 proxy by using SSH ...

ssh -D 9081 user@remote_server

... or use an alternative software such as tsocks or proxychains-ng.

Windows/Mac

From the official help:

  1. Click the Chrome menu Chrome menu on the browser toolbar.
  2. Select Settings.
  3. Click Show advanced settings.
  4. In the "Network" section, click Change proxy settings. This will open the Internet Properties dialog (Windows) or the Network dialog (Mac) where you can adjust your network settings. For more details, see proxy server settings in the Microsoft help site or entering proxy settings in the Apple support site.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>