Remove proxyHost logging if endpoint is included in nonProxyHosts
Describe the feature
Say that you are using the proxy "proxy.com" for regular traffic, but do not want to use proxy for S3. So you're adding the S3 endpoint, say "s3.com", to the nonProxyHosts property. If an exception now occurs, e.g. invalid bucket name, "proxy.com" is showing up in the logs:
Extended Request ID: 634205dd3 […]; Proxy: proxy.com
Use Case
This can be confusing, since you have added an exception in the nonProxyHosts list. Anyway, we spent hours to figure out why S3 was still using the proxy, even though we had added the endpoint to the exception list. So I read the source code and figured out that the nonProxyHosts property is ignored.
Proposed Solution
By using the following private method in AwsErrorResponseHandler instead of the one in ClientConfiguration, I think the problem is solved:
private String getProxyHost(URI endpoint) {
String nonProxyHosts = clientConfiguration.getNonProxyHosts();
if (nonProxyHosts != null && nonProxyHosts.contains(endpoint.getHost())) {
return null;
}
return clientConfiguration.getProxyHost();
}
Other Information
No response
Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
AWS Java SDK version used
1.12.205
JDK version used
openjdk 18.0.1.1 2022-04-22
Operating System and version
Linux 3.10.0-1160.53.1.el7.x86_64
Hi @erlendfg I'm sorry you lost time because of the logs. It's a reasonable request, marking as such.
A heads-up, the team is focused in Java SDK 2.0 work, so this feature is not in the high-priority list.