Document use of disableHostPrefixInjection for 2.18.x
See original GitHub issue2.18.x introduced virtual bucket addressing as standard
i.e.
Before 2.18.x: I connected to bucket foo
on mys3stub.mynetwork.local
But now: the SDK changes my configured hostname on the fly and tries to connect to foo.mys3stub.mynetwork.local
.
I don’t want to to have to setup DNS for every bucket name, I’d rather have the SDK connect the old way, without it modifying the hostname I configured. It’s unclear how to achieve this.
I can’t find any documentation on how to use disableHostPrefixInjection
which I think from reading the code will stop this behaviour happening. Can it be documented? (and can anyone tell me the recommended way to use it?)
UPDATE: On further testing this doesn’t seem to be the right option - any documentation you can provide on how to go back to having the bucket name in the path would be great
UPDATE 2: I’ve found something that works - is it right?
.forcePathStyle(true)
- code example is Scala
implicit val clientAsync: S3AsyncClient =
S3AsyncClient
.builder()
.credentialsProvider(credentialsProvider)
.region(region)
.forcePathStyle(true)
.endpointOverride(s3Uri)
.build()
Links
NA (not sure where it’s best to put it)
Issue Analytics
- State:
- Created a year ago
- Comments:5
I suggest that SDK error message would give a hint on what is incorrect. Current error message diverts from root cause.
software.amazon.awssdk.core.exception.SdkClientException: Received an UnknownHostException when attempting to interact with a service. See cause for the exact endpoint that is failing to resolve. If this is happening on an endpoint that previously worked, there may be a network connectivity issue or your DNS cache could be storing endpoints for too long.
In my usecase I had S3 on localstack for testing.
Hello @LuckySpb ,
Thank you very much for your feedback and for providing your use case. I have added a backlog item to provide better documentation support for the new SDK behavior. Your comment is very helpful to us!
I will update this ticket with all changes made.
Sincerely,
Yasmine