I am migrating our s3 java API from v1 to v2 version.
What I want to do is to generate presigned url. But I want to forge my presigned url because our need is to have a clear url not frightening the user. In our v1 version, we decided to create an url on the format https://bucket-name/object-key. then a rule in added in our DNS in order to redirect the request to the AWS server.
In order to achieve so, in v1 version, we created a s3Client and override the endpoint configuration with withEndpointConfiguration in order to force the domain to https://bucket-name.
Then when we instantiate the GeneratePresignedUrlRequest, we provided an empty string for the bucket.
This was working great.
With the V2 API, we don't see how to generate such a presigned url. I tried the endpointOverride method on my S3Presigner.builder but in that case I get an url like https://bucket-name/bucket-name/object-key. So the aws server answer is key does not exist because the key is understood as bucket-name/object-key. It is not possible to provide an empty string for the bucket name to GetObjectPresignRequest.builder because the key is provided via the GetObjectRequest who must know the bucket name.