Force Google Chrome / Chromium Browser to use WPAD proxy detection

At one of your school sites, we encountered an issue where several people could not access the internet via the school's proxy server when using Google Chrome / Chromium Browser

By default those two browser variants use the (Linux) system wide proxy settings. This is not always the best choice. For our setups, we prefer configuring proxy settings via WPAD [1].

We did not investigate each user profile for underlying reasons of not being able to connect via the site's proxy server in depth. Instead, we searched for a system-wide solution that easily enforces WPAD protocol usage when browsing the internet with Google Chrome / Chromium Browser.

From the command line, forcing Google Chrome / Chromium Browser into WPAD proxy mode is very easy. It can be done with the command line option --proxy-auto-detect:

[user@mymachine ~]$ chromium-browser --proxy-auto-detect

To enforce launching these two browser variants with --proxy-auto-detect whenever users click onto icons provided on the Linux desktop, you can simply follow the below recipe:

  1. Create /usr/local/share/applications/ unless it already exists
  2. Copy /usr/share/applications/google-chrome.deskop to /usr/local/share/applications/.
  3. Copy /usr/share/applications/chromium-browser.deskop to /usr/local/share/applications/.
  4. Set the x-bit on those .desktop files: sudo chmod a+x /usr/local/share/applications/*.desktop
  5. Edit both .desktop files and search for lines starting with Exec=. Add --proxy-auto-detect to each of those occurrences after the actual command (see diff below).
  6. Run update-desktop-database /usr/local/share/applications

When users now click on any of the provided launchers provided by Google Chrome / Chromium Browser, the browser attempts proxy detection via the WPAD protocol.

light+love,
Mike

[1] http://www.faqs.org/rfcs/rfc3040.html (section 6.4)



PS: Difference between Chromium Browser's default .desktop file and our modified version in /usr/local/share/applications/:

--- usr/share/applications/chromium-browser.desktop	2016-03-16 19:04:18.000000000 +0100
+++ usr/local/share/applications/chromium-browser.desktop	2016-04-01 14:23:27.410775206 +0200
@@ -167,7 +167,7 @@
 Comment[zh_CN]=访问互联网
 Comment[zh_HK]=連線到網際網路
 Comment[zh_TW]=連線到網際網路
-Exec=chromium-browser %U
+Exec=chromium-browser --proxy-auto-detect %U
 Terminal=false
 X-MultipleArgs=false
 Type=Application
@@ -216,7 +216,7 @@
 Name[vi]=Mở cửa sổ mới
 Name[zh_CN]=打开新窗口
 Name[zh_TW]=開啟新視窗
-Exec=chromium-browser
+Exec=chromium-browser --proxy-auto-detect
 
 [Desktop Action Incognito]
 Name=Open a New Window in incognito mode
@@ -254,7 +254,7 @@
 Name[vi]=Mở cửa sổ mới trong chế độ ẩn danh
 Name[zh_CN]=以隐身模式打开新窗口
 Name[zh_TW]=以匿名模式開啟新視窗
-Exec=chromium-browser --incognito
+Exec=chromium-browser --incognito --proxy-auto-detect
 
 [Desktop Action TempProfile]
 Name=Open a New Window with a temporary profile
@@ -292,4 +292,4 @@
 Name[vi]=Mở cửa sổ mới với hồ sơ tạm
 Name[zh_CN]=以临时配置文件打开新窗口
 Name[zh_TW]=以暫時性個人身分開啟新視窗
-Exec=chromium-browser --temp-profile
+Exec=chromium-browser --temp-profile --proxy-auto-detect



PPS: Similar for Google Chrome:

--- usr/share/applications/google-chrome.desktop	2016-04-01 14:02:29.388283436 +0200
+++ usr/local/share/applications/google-chrome.desktop	2016-04-01 14:13:59.381895899 +0200
@@ -105,7 +105,7 @@
 Comment[zh_CN]=访问互联网
 Comment[zh_HK]=連線到網際網路
 Comment[zh_TW]=連線到網際網路
-Exec=/usr/bin/google-chrome-stable %U
+Exec=/usr/bin/google-chrome-stable --proxy-auto-detect %U
 Terminal=false
 Icon=google-chrome
 Type=Application
@@ -165,7 +165,7 @@
 Name[vi]=Cửa sổ Mới
 Name[zh_CN]=新建窗口
 Name[zh_TW]=開新視窗
-Exec=/usr/bin/google-chrome-stable
+Exec=/usr/bin/google-chrome-stable --proxy-auto-detect
 TargetEnvironment=Unity
 
 [NewIncognito Shortcut Group]
@@ -218,5 +218,5 @@
 Name[vi]=Cửa sổ ẩn danh mới
 Name[zh_CN]=新建隐身窗口
 Name[zh_TW]=新增無痕式視窗
-Exec=/usr/bin/google-chrome-stable --incognito
+Exec=/usr/bin/google-chrome-stable --proxy-auto-detect --incognito
 TargetEnvironment=Unity