Closed
Description
Is your feature request related to a problem? Please describe.
We have use cases where we would like to block all private IPs, hostnames using the NO_PROXY env variable. We want to specify whole CIDR blocks rather than whitelist each single IP, for example (NO_PROXY=172.16.0.0/12, 192.168.0.0/16).
Today the library only supports the NO_PROXY to be a list of single IPs (NO_PROXY=172.16.0.10, 192.168.0.10) and checks the host we're reaching against the list.
Describe the solution you'd like
- Add NO_PROXY parsing to get the host_ip and the mask for each element.
- Check if the targeted IP falls in the IP range of the CIDR.
Implementation (fix: support CIDR blocks in no_proxy env variable #2876)
In other languages
- Golang: according to the documentation for http.ProxyFromEnvironment, the NO_PROXY environment variable does not natively support CIDR blocks. Instead, it only supports exact hostnames or IP addresses (optionally including ports).
- C-core supports using CIDR blocks in NO_PROXY(implementation) (doc)