Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

S3Presigner behaving strange with s3Client while generating pre signed url on local #6041

Unanswered
vermyog asked this question in Q&A
Discussion options

You must be logged in to vote

Replies: 3 comments 2 replies

Comment options

Can you share a code sample showing how you are creating the S3Presigner?

You must be logged in to vote
2 replies
Comment options

S3Presigner presigner = S3Presigner.builder().s3Client(this.s3Client.getS3Client()).build();

 URL var18;
 try {
 GetObjectRequest objectRequest = (GetObjectRequest)GetObjectRequest.builder().bucket(bucketName).key(objectKey).responseContentDisposition(contentDisposition).responseContentType(contentType).build();
 GetObjectPresignRequest presignRequest = GetObjectPresignRequest.builder().signatureDuration(Duration.ofSeconds(seconds)).getObjectRequest(objectRequest).build();
 PresignedGetObjectRequest presignedRequest = presigner.presignGetObject(presignRequest);
 var18 = presignedRequest.url();
 } catch (Throwable var20) {
 if (presigner != null) {
 try {
 presigner.close();
 } catch (Throwable var19) {
 var20.addSuppressed(var19);
 }
 }
 throw var20;
 }
 if (presigner != null) {
 presigner.close();
 }
 return var18;
Comment options

You need set endpointOverride and serviceConfiguration in the S3Presigner builder:

 S3Presigner presigner = S3Presigner.builder()
 .endpointOverride(new URI("http://localhost:9000/"))
 .serviceConfiguration(S3Configuration.builder()
 .pathStyleAccessEnabled(true)
 .build())
 .build();
Comment options

Thanx it worked now!

I think its not working while creating S3Presigner with s3Client

You must be logged in to vote
0 replies
Comment options

Hello! Reopening this discussion to make it searchable.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /