Using proxy servers on Linux
β’ 239 words β’ 2 min β’ updated
There are some times when you need to connect your PC to an access point which
requires you to route your connections through a web proxy. No panic! It is
really simple to config your linux desktop (or server, for that matter) to do
it. You just have to modify your http_proxy and https_proxy environment
variables.
For example:
export http_proxy=http://1.2.3.4:3128
export https_proxy=http://1.2.3.4:3128
export HTTP_PROXY=http://1.2.3.4:3128
export HTTPS_PROXY=http://1.2.3.4:3128After that, just execute your favorite web browser then test your new settings. Beware! You have to execute your web browser through the command-line, in the same shell that you have exported those environment variables. For example:
$ export HTTP_PROXY=http://1.2.3.4:3128 && chromium &Starting the .desktop application of your web browser, for example, wouldn’t
work, unless you store those environment variables in a system wide directory
(good recommendations include /etc/profile and /etc/profile.d/_).
However, from my experience, this is limited in the sense that it would be the default proxy of your system, which isn’t what you probably want β the common use case is: connect to some AP, switch to its proxy, and after a while disconnect from it and throw away its proxy.
Simple, isn’t it? If you want to automate this task a little more, please refer to the Arch Wiki β from where this post was originally inspired.
Also, I needed to apply this setup in a real world situation and I can confirm it works really well.