I'm using my laptop sometimes behind a proxy and sometimes not. I've created an /etc/apt/apt.conf file, I've used it like that for the last 2 years:
when behind a proxy I add the line:
Acquire::http::proxy "http://myproxy:8080/";
when I don't need proxy authentication, I remove or comment it out.
it worked so well like that, but now whenever I try to run any apt-get
command it tries to connect to the proxy server, even with these lines commented out, or with apt.conf doesn't even exist.