Is it possible to configure something (in one place) that directs all http and https traffic through a specific proxy.

At work we need to go through a proxy to get to the outside world. That proxy address needs to configured into a lot of applications. Here is some of the places:

  • System Settings (Which should be system wide, but only applies to browsers)
  • Spotify
  • IntelliJ
  • Maven
  • /etc/environment

At home there is no proxy and I would like to easily disable proxy. It is a lot of work changing the configuration of all the applications each time you change location.

Can you intercept traffic and redirect it through a local proxy which then can be configured to forward to the proxy or just go directly to the requested address?

  • 2
    If you use System Settings and apply system-wide, changes are made to /etc/environment. It's up to the rest of the apps to honour http_proxy and https_proxy, etc. Most standard Ubuntu programs do. If Spottify or Maven doesn't, it's on them. That said, you could always run squid yourself, so the programs are always using your localhost proxy, and squid configuration handles whether a real proxy is being used or not. That's what I used to do. – muru Feb 9 '16 at 21:01
  • @muru Could you provide an answer on how to configure squid :) – AnAmuser Feb 10 '16 at 7:50

You can setup this

vi /etc/environment

append these lines


and after that

source /etc/environment

and for installation of packages etc...via apt-get Create a file called 95proxies in /etc/apt/apt.conf.d/, and include the following:

Acquire::http::proxy "http://myproxy.server.com:8080/";
Acquire::ftp::proxy "ftp://myproxy.server.com:8080/";
Acquire::https::proxy "https://myproxy.server.com:8080/";
  • I did this but still need to configure each individual application. – AnAmuser Feb 9 '16 at 20:39
  • You don't have to. These are system wide settings. You can specify even JAVA_HOME in /etc/environment. Once you specify JAVA_HOME in that and follow the steps that i mentioned. Maven, Gradle and everybody start considering JAVA_HOME mentioned out there. – Ashu Feb 9 '16 at 20:46
  • I've encountered instances where Maven still ignored the http_proxy in /etc/environment. Maven was only able to fetch after I added ~/.m2/settings.xml. – wisbucky Sep 25 '18 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.