Last updated on October 6, 2020 by Dan Nanni
When you are behind HTTP proxy, you need to configure proxy settings for your applications in one way or another. Typically you define http_proxy environment variable pointing to your proxy, so that all HTTP requests go through the proxy. But what if you want to bypass HTTP proxy for specific destination web servers? That's when you need to configure HTTP proxy exceptions.
On Linux, you can define HTTP proxy exceptions via no_proxy
environment variable. In no_proxy
variable, you specify a list of domain names or IP addresses for which HTTP proxy should not be used. Along with domain names or IP addresses, you can also specify port number if necessary.
If you would like to define HTTP proxy exceptions system wide, do the following.
$ sudo vi /etc/environment
http_proxy="http://proxy.com:8000" no_proxy="127.0.0.1, localhost, *.cnn.com, 192.168.1.10, domain.com:8080"
$ sudo vi /etc/profile.d/proxy.sh
export http_proxy="http://proxy.com:8000" export no_proxy="127.0.0.1, localhost, *.cnn.com, 192.168.1.10, domain.com:8080"
The above example means that if you are reaching local host (e.g., 127.0.0.1
, localhost
), *.cnn.com
, domain.com:8080
, or a host with IP address 192.168.1.10
, you will not use HTTP proxy. For all other destinations, you will use the designated HTTP proxy (proxy.com:8000
).
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean