Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
Android AWS S3 TransferUtility silently ignores proxy settings in ClientConfiguration

I'm using the AWS SDK for Android to download objects from S3 to my Android tablet. In an attempt to route traffic through a proxy (right now I'm using Charles Proxy on my local network as a test bed) to throttle the download speed of the S3 downloads, I'm using ClientConfiguration.setProxyHost and setProxyPort but the S3 TransferUtility appears to be ignoring the setting and going directly to AWS S3 not the proxy.

The code without the proxy set works fine. Objects are downloaded successfully. The code with the proxy set behaves exactly the same, and the proxy doesn't show any connection from the tablet.

I have proven to myself that the proxy works by setting the proxy host and port in the Android tablet Wifi settings (setting proxy manually) and the proxy shows the AWS S3 connections traveling through the proxy successfully.

At first, I thought the AmazonS3Client was ignoring my ClientConfiguration entirely but I've proven that when I set the ClientConfiguration.setProtocol from HTTPS to HTTP the AWS TransferUtility changes from http to https as the AWS endpoint.

The code looks like every other sample code for setting the proxy that I can find using ClientConfiguration and TransferUtility.

ClientConfiguration getClientConfiguration() {
    return new ClientConfiguration()
            .withMaxConnections(2)
            .withProxyHost("192.168.1.137")
            .withProxyPort(8888)
            .withConnectionTimeout(30 * 1000) // Wait 30 seconds to make a connection
            .withSocketTimeout(0); // Keep open connections open indefinitely (we have very large downloads)
}
public S3Controller(Context context) {
    java.util.logging.Logger.getLogger("com.amazonaws").setLevel(java.util.logging.Level.FINEST);
    applicationContext = context.getApplicationContext();

    clientConfig = getClientConfiguration();

    s3Client = new AmazonS3Client(getCredentials(), clientConfig);

    transferUtility = new TransferUtility(s3Client, applicationContext);

    pendingTransfers = new PendingTransferQueue();

}

// ... later

TransferObserver observer = transferUtility.download(BuildConfig.S3_BUCKET, key, file);

As you can see I also tried setting the logging level of the amazonaws to FINEST in order to get some visibility on where the proxy is failing with no additional logging showing up.

Any suggestion on why AWS SDK is ignoring my proxy or how I can set logging to find out more details on where it is failing?

Thanks in advance.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

So what I found is that I can instantiate the com.amazonaws.http.ApacheHttpClient class and it will use the protected HttpClientFactory package that configures the proxy set in clientConfig.

The AmazonS3Client creation uses a different constructor to pass the HttpClient that has the proxy configured as follows:

 HttpClient httpClient = new ApacheHttpClient(clientConfig); s3Client = new AmazonS3Client(getCredentialsProvider(), clientConfig, httpClient);
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!