Also available in:

The option Acquire::http::Proxy-Auto-Detect already exists for some time. It was intended to be used with the package squid-deb-proxy-client which is a helper for the APT http method to discover proxies that publish their service as _apt_proxy._tcp. It was justed upgraded (version 1.0.8) and now add the URL as a paramater. It is now possible to discover a common proxy through a proxy.pac script.

My proposed solution uses the package libproxy-tools and is a shell script wrapper.

Packages to install

The following packages are needed:

libproxy-tools brings the proxy command.

libproxy1-plugin-mozjs or libproxy1-plugin-webkit to evaluate wpad.dat or proxy.pac files.

Shell script wrapper

Line 2 is optional, it allows to force search of an automatic proxy for the root user when it does not have KDE or Gnome proxy setting (or plugins networkmanager, gsettings or kconfig are not installed).

Filtering with awk allows to provide one proxy to APT (indeed, several proxies may be returned by the proxy command (and proxy.pac files).