Why is apt-get always using proxy, although no proxy is configured?

I'm using a script to replace different configuration files in order to easily switch between proxy and non-proxy environements. The problem was that I replaced the proxy apt.conf file with an empty apt.conf file, which apt then ignored.

Works for current latest Ubuntu as well.

If the proxy conf does not exist, create it:

$ sudo touch /etc/apt/apt.conf.d/95proxy.conf

Then add the following two lines:

Acquire::http::Proxy "false";
Acquire::https::Proxy "false";

If you do not want apt-get to use a proxy, use apt-get as:

sudo apt-get -o Acquire::http::proxy=false <update/install>