Describe the bug
This is an issue related to the closed issue #6414
PR for closing: #6511
Hi @alextwoods , @bhoradc , @debora-ito
Thanks for the time looking into the issue. I've seen the fix and try to get my code working with these changes:
- Uploading
software.amazon.awssdk:s3 to 2.36.3
- Transitively, upload
software.amazon.awssdk:crt-core2.36.3`
- Uploading
software.amazon.awssdk.crt to 0.39.4
Being LocalStack deployed on my local machine:
System.setProperty("https.proxyHost", "proxy.example.com");
System.setProperty("https.proxyPort", "8080");
System.setProperty("http.nonProxyHosts", "127.0.0.1");
System.setProperty("aws.crt.log.level","Trace");
System.setProperty("aws.crt.log.destination","Stdout");
S3AsyncClient s3Async =
S3AsyncClient.crtBuilder()
.endpointOverride(localstack.getEndpoint())
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create(
localstack.getAccessKey(), localstack.getSecretKey())))
.region(Region.of(localstack.getRegion()))
.responseChecksumValidation(ResponseChecksumValidation.WHEN_REQUIRED)
.requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED)
.httpConfiguration(S3CrtHttpConfiguration.builder()
.proxyConfiguration(AwsCloudStorageUtils.getProxyConfiguration())
.build())
.build();
S3TransferManager transferManager = S3TransferManager.builder()
.s3Client(s3Async)
.build();
ProxyConfig:
/**
* Obtains the proxy configuration from system properties. If the https.proxyHost property is not
* set, this method returns null indicating no proxy should be used.
*
* @return an S3CrtProxyConfiguration object if the proxy is configured, or null if no proxy is
* set.
*/
public static S3CrtProxyConfiguration getProxyConfiguration() {
String proxyHost = System.getProperty("https.proxyHost");
// Si no hay host configurado, no usar proxy
if (StringUtils.isEmpty(proxyHost)) {
return null;
}
// Puerto por defecto es 8080 si no se especifica
String proxyPortStr = System.getProperty("https.proxyPort");
int proxyPort = 8080; // Puerto por defecto del SDK de AWS
if (!StringUtils.isEmpty(proxyPortStr)) {
try {
proxyPort = Integer.parseInt(proxyPortStr.trim());
} catch (NumberFormatException e) {
// Si el puerto no es válido, usar el puerto por defecto
proxyPort = 8080;
}
}
return (S3CrtProxyConfiguration) S3CrtProxyConfiguration.builder()
.host(proxyHost.trim())
.port(proxyPort)
.nonProxyHosts(getNonProxyHosts())
.build();
}
/**
* Retrieves and parses the http.nonProxyHosts system property. Converts wildcard patterns
* (*.domain.com) to proper regex patterns (.*\.domain\.com). The property should contain hosts
* separated by pipe (|) characters.
* <p>
* Example input: "169.254.169.254|169.254.170.2|*.amazonaws.com|*.corp" Example output:
* {"169\.254\.169\.254", "169\.254\.170\.2", ".*\.amazonaws\.com", ".*\.corp"}
*
* @return a Set of String containing properly escaped regex patterns for non-proxy hosts
*/
public static Set<String> getNonProxyHosts() {
Set<String> result = new HashSet<>();
String nonProxyHosts = System.getProperty("http.nonProxyHosts");
if (StringUtils.isEmpty(nonProxyHosts)) {
return result;
}
String[] hosts = nonProxyHosts.split("\\|");
for (String host : hosts) {
String trimmedHost = host.trim();
result.add(trimmedHost);
}
return result;
}
Then I store two files in a "directory" called test-files/ , with a non-Crt S3 Client. Then I try do download them with the Crt client above.
I see the same log in the execution
[INFO] [2025-10-29T14:33:41Z] [0000000300f67000] [http-connection] - (STATIC) Connecting to "127.0.0.1" through a tunnel via proxy "proxy.example.com"
Is this bug fixed really? Reading comments in PR I thought it was transparent for us. Is there any change that should be done from our side?
Full log included
BugAwsNonProxyHosts.txt
Regression Issue
Expected Behavior
Connect to my Localstack instance on 127.0.0.1 without any attempt to go through the invalid proxy "proxy.example.com"
Current Behavior
The connection is taking place through a tunnel via proxy:
BugAwsNonProxyHosts.txt
Reproduction Steps
Use the following values for these properties:
System.setProperty("https.proxyHost", "proxy.example.com");
System.setProperty("https.proxyPort", "8080");
System.setProperty("http.nonProxyHosts", "127.0.0.1");
System.setProperty("aws.crt.log.level","Trace");
System.setProperty("aws.crt.log.destination","Stdout");
- Create a LocalStack sandbox for testing
@Container
public static LocalStackContainer localstack =
new LocalStackContainer(DockerImageName.parse("localstack/localstack:0.11.3"))
.withServices(S3);
- Create S3Client (not async), S3AsyncClient (Crt) and a TransferManager client based on the async s3 client:
S3Client s3 = S3Client.builder()
.endpointOverride(localstack.getEndpoint())
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create(
localstack.getAccessKey(), localstack.getSecretKey())))
.region(Region.of(localstack.getRegion()))
.responseChecksumValidation(ResponseChecksumValidation.WHEN_REQUIRED)
.requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED)
.build();
S3AsyncClient s3Async =
S3AsyncClient.crtBuilder()
.endpointOverride(localstack.getEndpoint())
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create(
localstack.getAccessKey(), localstack.getSecretKey())))
.region(Region.of(localstack.getRegion()))
.responseChecksumValidation(ResponseChecksumValidation.WHEN_REQUIRED)
.requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED)
.httpConfiguration(S3CrtHttpConfiguration.builder()
.proxyConfiguration(AwsCloudStorageUtils.getProxyConfiguration())
.build())
.build();
S3TransferManager transferManager = S3TransferManager.builder()
.s3Client(s3Async)
.build();
This is the configuration I am using:
public static S3CrtProxyConfiguration getProxyConfiguration() {
String proxyHost = System.getProperty("https.proxyHost");
if (StringUtils.isEmpty(proxyHost)) {
return null;
}
String proxyPortStr = System.getProperty("https.proxyPort");
int proxyPort = 8080;
if (!StringUtils.isEmpty(proxyPortStr)) {
try {
proxyPort = Integer.parseInt(proxyPortStr.trim());
} catch (NumberFormatException e) {
proxyPort = 8080;
}
}
return (S3CrtProxyConfiguration) S3CrtProxyConfiguration.builder()
.host(proxyHost.trim())
.port(proxyPort)
.nonProxyHosts(getNonProxyHosts())
.build();
}
public static Set<String> getNonProxyHosts() {
Set<String> result = new HashSet<>();
String nonProxyHosts = System.getProperty("http.nonProxyHosts");
if (StringUtils.isEmpty(nonProxyHosts)) {
return result;
}
String[] hosts = nonProxyHosts.split("\\|");
for (String host : hosts) {
String trimmedHost = host.trim();
result.add(trimmedHost);
}
return result;
}
- Create buckets, upload files... using the S3Client (not async)
- Try to download a directory (for example) with the AsyncS3Client via TransferManager
Possible Solution
No response
Additional Information/Context
Using 0.39.4 version of aws-crt: https://mvnrepository.com/artifact/software.amazon.awssdk.crt/aws-crt/0.39.4
AWS Java SDK version used
2.36.3
JDK version used
java version "21.0.1" 2023-10-17 LTS
Operating System and version
MacOS 26.0.1 (25A362)
Describe the bug
This is an issue related to the closed issue #6414
PR for closing: #6511
Hi @alextwoods , @bhoradc , @debora-ito
Thanks for the time looking into the issue. I've seen the fix and try to get my code working with these changes:
software.amazon.awssdk:s3to2.36.3software.amazon.awssdk:crt-core2.36.3`software.amazon.awssdk.crtto0.39.4Being LocalStack deployed on my local machine:
ProxyConfig:
Then I store two files in a "directory" called test-files/ , with a non-Crt S3 Client. Then I try do download them with the Crt client above.
I see the same log in the execution
Is this bug fixed really? Reading comments in PR I thought it was transparent for us. Is there any change that should be done from our side?
Full log included
BugAwsNonProxyHosts.txt
Regression Issue
Expected Behavior
Connect to my Localstack instance on 127.0.0.1 without any attempt to go through the invalid proxy "proxy.example.com"
Current Behavior
The connection is taking place through a tunnel via proxy:
BugAwsNonProxyHosts.txt
Reproduction Steps
Use the following values for these properties:
This is the configuration I am using:
Possible Solution
No response
Additional Information/Context
Using 0.39.4 version of aws-crt: https://mvnrepository.com/artifact/software.amazon.awssdk.crt/aws-crt/0.39.4
AWS Java SDK version used
2.36.3
JDK version used
java version "21.0.1" 2023-10-17 LTS
Operating System and version
MacOS 26.0.1 (25A362)