Open BSchwetzel opened 2 months ago
Moving to the Java SDK 2.x repository.
This would be a feature request, similar to the ask for NO_PROXY to support IP ranges - https://github.com/aws/aws-sdk-java-v2/issues/5399.
We follow the format established in the JDK Network Properties documentation and it only defines *
as the wildcard. But I understand that environment variables are supposed to be used across different applications and the lack is standard is a pain.
Upcoming End-of-Support
Describe the bug
We are using the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY (as well as their lowercase variants for compatibility reasons, their values are the same) to access the internet via proxy, while connecting to internal domains without the proxy.
When using the S3 SDK we observed that wildcard entries in the
NO_PROXY
/no_proxy
are not working as intended, as those wildcards (which are of the form.some.domain
to include subdomains ofsome.domain
likesub.some.domain
andmore.sub.some.domain
) need a*
prepended to work in Java, like*.some.domain
.Expected Behavior
When using the SDK (we are currently using it for S3 only) we would expect that our internal S3-compatible endpoint (
s3.storage.company.internal
for the sake of this issue) is not requested via the proxy, given the following environment variables:HTTP_PROXY
/HTTPS_PROXY
/http_proxy
/https_proxy
:http://proxy.company.internal:3128
NO_PROXY
/no_proxy
:.company.internal,.local,127.0.0.1,localhost
Current Behavior
The S3 endpoint
s3.storage.company.internal
is requested via the proxy.Reproduction Steps
Running the following code with
NO_PROXY
set to.company.internal,127.0.0.1,localhost
will printsoftware.amazon.awssdk.services.s3.model.S3Exception: (Service: S3, Status Code: 403, Request ID: null)
, due to our proxy blocking requests to internal domains with a HTTP 403. Other proxy implementations might give different errors or simply also proxy internal domains, but ours doesn't, or else we would not have spotted this issue.The same command with
NO_PROXY
set to*.company.internal,127.0.0.1,localhost
will print a list of our buckets, as expected.Possible Solution
Currently, the
NO_PROXY
/no_proxy
variables are transformed such that,
is replaced by|
, as can be seen here: https://github.com/aws/aws-sdk-java/blob/61d73631fac8535ad70666bbce9e70a1d2cea2ca/aws-java-sdk-core/src/main/java/com/amazonaws/ClientConfiguration.java#L1129What should also be done is that for every entry in this
|
-separated list, if the entry starts with a.
, this should be replaced with*.
.Meaning: Our
NO_PROXY
/no_proxy
value.company.internal,.local,127.0.0.1,localhost
should be effectively converted to*.company.internal|*.local|127.0.0.1|localhost
.Additional Information/Context
No response
AWS Java SDK version used
2.27.20
JDK version used
OpenJDK Runtime Environment Temurin-21.0.4+7 (build 21.0.4+7-LTS)
Operating System and version
Windows 10 Enterprise (Build 19045.4780)