62

When I try to set Google Chrome's proxy settings (on chrome://linux-proxy-config/), I get the following message:

When running Google Chrome under a supported desktop environment, the system proxy settings will be used. However, either your system is not supported or there was a problem launching your system configuration.

But you can still configure via the command line. Please see man google-chrome-stable for more information on flags and environment variables.

I need to set proxy settings to use Chrome, but I don't want to be setting them in the command line every time I use Chrome. Is there a way to set these settings permanently?

Also, is there an option in Chrome so that it doesn't use proxy for specific domains (analogous to the No proxy for setting in Firefox)?

1
  • @KasiyA I don't want to use Chrome without proxy. I want to use proxy for most domains, except for a few, which are local to my network.
    – a06e
    Aug 20, 2014 at 15:11

9 Answers 9

53

Open a Terminal and type sudo -H nautilus

Type your password then press Ctrl+L and type /usr/share/applications/ and press Enter

Now find google-chrome and right-click on chrome icon and select "Properties".

Next, Add the following option at the end of command text box, there.

--proxy-server="IP proxy Server:port" (ex: --proxy-server="127.0.0.1:8080")

it's look like this (it's the same for Chrome):

enter image description here close the window and if the chrome browser is still running, then close the browser and restart again. Finally you can use chrome browser with proxy.

--proxy-bypass-list:

If you want to tell google-chrome to NOT use a proxy with specific domains use --proxy-bypass-list command. This command specifies a list of hosts for whom we bypass proxy settings and use direct connections. Ignored if --proxy-auto-detect or --no-proxy-server are also specified. This is a comma-separated list of bypass rules.

Here is List of Chromium Command Line that used in google-chrome too.

7
  • 1
    How do I tell google chrome to NOT use a proxy with specific domains? Something like the option No proxy for in Firefox?
    – a06e
    Aug 20, 2014 at 15:55
  • How would one specify the username/password when using --proxy-server? Jan 21, 2015 at 16:50
  • 2
    @user2813274 you should use this syntax user:password@proxy:port (for an example: --proxy-server="USERhere:[email protected]:8080") Jan 21, 2015 at 17:00
  • What is the syntax for --proxy-bypass-list? Should I just list the bypassed hosts after it? Should I use ="list"? List entries are separated by what? Semicolons? Commas? Can you add an example to your answer?
    – Calmarius
    May 22, 2015 at 11:51
  • 1
    Chromium has been silently ignoring proxy arguments for the past couple of years, at least on Linux. I know this is how you're "supposed to do it", but it simply doesn't work and there is nothing you can do except use a different browser.
    – user27636
    Oct 26, 2018 at 20:03
20

Google Chrome and Chromium obey the environment proxy variables (http_proxy, no_proxy, etc.) and the proxies set via gsettings. gsettings comes preinstalled on [XL]ubuntu, so this is one way which doesn't need sudo privileges.

The keys org.gnome.system.proxy.http[s].{host,port,authentication-user,authentication-user} (and similar options for FTP and SOCKS proxies) and the proxy autoconfiguration key org.gnome.system.proxy.autoconfig_url can be used for this:

gsettings set org.gnome.system.proxy.http host "proxy.server.fqdn"
gsettings set org.gnome.system.proxy.http port "3128"

A proxy exception list can be set using the ignore-hosts key:

gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.0/8', '::1', '*.some.domain', '10.0.0.0/8']" 

A no_proxy environment variable would look like:

export no_proxy="localhost,.some.domain,127.0.0.0/8,10.0.0.0/8"
export NO_PROXY="localhost,.some.domain,127.0.0.0/8,10.0.0.0/8"

You can set this in ~/.profile or ~/.pam_environment (without the export).

6
  • 2
    I have a different experience. Chrome 61.0.3163.100 on Ubuntu 17.04 doesn't seem to use http_proxy and https_proxy vars. They are set for my user in ~/.profile, which is the same user Chrome is started with, but Chrome can't connect..
    – Julius
    Sep 27, 2017 at 11:38
  • 1
    @Julius which DM?
    – muru
    Sep 27, 2017 at 12:35
  • 1
    Dear @muru, can I set a proxy username and password by using gsettings set org.gnome.system.proxy.http ? Feb 4, 2019 at 15:05
  • Setting the gsettings values, which map to Ubuntu's system proxy in its UI, is the only way I could get Chrome to use my corporate proxy. Using Ubuntu 18.04.4 + Chrome 80, the _proxy and _PROXY env vars do NOT seem to be used, which is what Firefox seems to do. May 6, 2020 at 19:05
  • 1
    @jhasse apparently there's no way currently: github.com/GNOME/gsettings-desktop-schemas/blob/master/schemas/… (in the past I ran my own squid server locally to perform authentication)
    – muru
    Nov 4, 2020 at 8:36
14

Just execute below command in terminal

sudo nano /usr/share/applications/google-chrome.desktop

in Command value append below line

--proxy-server="192.168.1.251:8080" 

Change it with your proxy. its example of non - authentication proxy. For a proxy with authentication one should use,

--proxy-server="username:password@proxy_address:port"
4
  • Very nice, and it also works with Chrome apps. Mar 2, 2015 at 19:34
  • for chromium, the particular file is /usr/share/applications/chromium-browser.desktop and the particular setionc is Exec - you must put the proxy line into all Exec appearences across this file
    – ulkas
    Oct 22, 2015 at 11:29
  • sometime chrome is stuck with waiting for proxy server. so adding --no-proxy-server option saves the day. Thanks. May 5, 2017 at 12:34
  • 1
    The problem with this approach is that every time chromium package gets updated, desktop file is overwritten, and the setting is lost.
    – jesjimher
    Apr 9, 2018 at 7:55
7

For Unity: In "system settings", go to "network" then "network proxy" : you can then set your proxy system wide.

For setting user and password , set it like this : user:password@proxy:port

For Lubuntu , Xubuntu etc...: look this thread How do I set systemwide proxy servers in Xubuntu, Lubuntu or Ubuntu Studio?

4
  • I am using Lubuntu. Where do I find "System Settings"?
    – a06e
    Aug 20, 2014 at 15:10
  • Yep, answer was for Unity .May be you use command: export http_proxy="user:password@proxy:port" then command for chrome, in a 2 line script.
    – laugeo
    Aug 20, 2014 at 15:13
  • Google Chrome is currently not taking care of system-wide proxy settings.
    – Anto
    Jan 28, 2015 at 13:06
  • This, IMHO, shoudl be the accepted answer. Google will use the system proxy. Jan 19, 2016 at 16:13
5

Semi-automated way

I have found @αғsнιη answer to be most helpful.

However, every update of Google Chrome resulted in resetting the desktop entry and proxy settings. It is quite frustrating editing it again, and again.


Instead of manual work, you can change the entry with a short script.

Simply paste it to terminal:

sudo sed '/^Exec/s/$/ --proxy-server="10.0.2.2:3128"/' /usr/share/applications/google-chrome.desktop  -i

Obviously, you need to change the IP to your proxy server.


This appends all lines starting with Exec with your proxy setting, which is the manual way of setting the proxy.

Enjoy!

1
  • Since Chrome/mium tends to stay semi-open in the taskbar, there's really no need to append proxy parameters to every Exec instance. Just the main one (named Chromium Web Browser) is usually enough. The rest of Exec instances are used for actions like opening a new window, which usually happen once the browser is up and running.
    – jesjimher
    Apr 9, 2018 at 8:07
3

How do I set systemwide proxy servers in Xubuntu, Lubuntu or Ubuntu Studio? points to the file /etc/environment where you can insert the following lines as root:

http_proxy=http://myproxy.server.com:8080/
https_proxy=http://myproxy.server.com:8080/
ftp_proxy=http://myproxy.server.com:8080/
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

The top answer (very elaborate) also contains a script to enable/disable on demand. (But if you need that, Firefox has an options page for choosing the proxy and you might want to consider using it).

3

When the proxy settings are in the environment proxy variables, Chrome did not work by putting the full proxy settings on the launcher.

--proxy-server="IP proxy Server:port" (ex: --proxy-server="127.0.0.1:8080")

But it worked when I put it to detect the automatic configurations

--proxy-auto-detect

And it worked in Vivaldi.

2

One option I use is the Proxy SwitchyOmega extension. It allows some IP addresses or domains to be exempted, as you ask for.

It has a nice GUI instead of needing to deal with command line arguments. It also supports Chrome Sync, so you can get up and running with your proxy settings on a new computer quickly.

You can also set it up so that using the proxy can be switched on or off with a single click.

0
1

Open Terminal

sudo gedit /usr/share/applications/google-chrome.desktop

--> in Exec value append below line

--proxy-server="10.1.6.14:3128"

(enter your nw proxy instead of 10.1.6.14 and port instead of 3128)

example:

Exec=/usr/bin/google-chrome-stable %--proxy-server="10.1.6.14:3128"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .