Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

238
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda