The doc for CurlTransportOptions::Proxy says
@remark The default value is an empty string (no proxy).
which is inaccurate according to CURL API reference https://curl.se/libcurl/c/CURLOPT_PROXY.html.
Setting the proxy string to "" (an empty string) will explicitly disable the use of a proxy, even if there is an environment variable set for it.
The CURLOPT_PROXY and CURLOPT_NOPROXY options override environment variables.
There are two scenarios with a small difference here:
- proxy is not set, follow environment variable.
- proxy is explicitly set to empty, do NOT use proxy even if environment variable is set.
With current curl transport implementation, we can only do 1) but not 2).
I encountered this problem when I'm working on a small project recenlty, where user can use a global proxy for all programs by setting environment variables.
But the program itself will send out some requests to localhost, which shouldn't go through proxy. An example of such requests is Access Azure Instance Metadata Service.
Is there any way to get around this issue? @vhvb1989
The doc for
CurlTransportOptions::Proxysayswhich is inaccurate according to CURL API reference https://curl.se/libcurl/c/CURLOPT_PROXY.html.
There are two scenarios with a small difference here:
With current curl transport implementation, we can only do 1) but not 2).
I encountered this problem when I'm working on a small project recenlty, where user can use a global proxy for all programs by setting environment variables.
But the program itself will send out some requests to localhost, which shouldn't go through proxy. An example of such requests is Access Azure Instance Metadata Service.
Is there any way to get around this issue? @vhvb1989