Skip to content

There's no way to skip proxy for a specific request disregarding proxy environment variable #3537

@Jinming-Hu

Description

@Jinming-Hu

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:

  1. proxy is not set, follow environment variable.
  2. 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

Metadata

Metadata

Assignees

Labels

Azure.CoreClientThis issue points to a problem in the data-plane of the library.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions