awslabs / aws-c-http

C99 implementation of the HTTP/1.1 and HTTP/2 specifications
Apache License 2.0
137 stars 42 forks source link

Support `NO_PROXY` environment variable #413

Open poconnor-lab49 opened 1 year ago

poconnor-lab49 commented 1 year ago

There does not appear to be a way to add a list of hosts which should not be proxied if HTTP_PROXY or HTTPS_PROXY are set.

The current workaround is to unset HTTP_PROXY whenever I want to run against localhost, but this obviously won't work if I need to reach a mix of resources which should and should not be be proxied.

Please add support for NO_PROXY and no_proxy to match the HTTP_PROXY env variable support.

davejoyce-lab49 commented 1 year ago

@poconnor-lab49 I think we may need to agree on no_proxy behavior, as it has an interesting history.

See: We need to talk: Can we standardize NO_PROXY?

poconnor-lab49 commented 1 year ago

@poconnor-lab49 I think we may need to agree on no_proxy behavior, as it has an interesting history.

See: We need to talk: Can we standardize NO_PROXY?

I read the exact same article! Very informative.

My gut says to follow the principle of least surprise and do roughly what curl does. I'd target the lowest common denominator from that article and not bother with CIDR block matching.

bryanlb commented 1 year ago

The lack of NO_PROXY support for this implementation definitely caught us by surprise when attempting to swap AWS clients. We default traffic through squid proxies and then use NO_PROXY to exclude a list of endpoints, which prevents us from using the above workaround.

yasminetalby commented 1 year ago

Hello everyone,

Thank you very much for this submission and showcasing your interest in this feature. To provide an update we have discussed this feature and it is currently in the team backlog.

I will provide all updates about this feature here.

Best regards,

Yasmine

poconnor-lab49 commented 1 year ago

Thank you and great timing! See https://github.com/curl/curl/discussions/11962

waahm7 commented 1 year ago

Hello everyone,

aws-c-http and aws-c-s3 support disabling reading of env variables via a parameter, which is helpful for disabling the reading of env variables instead of unsetting them. The Java SDK v2 has a PR that exposes this setting for CRTS3Client. Sharing this as it may be useful for some use cases.