Skip to content

S3 temporary redirect - intended handling of such redirects for v2? #4063

Answered by debora-ito
boaks asked this question in Q&A
Discussion options

You must be logged in to vote

What withRedirectLocation does in Java SDK v1 is to add a "x-amz-website-redirect-location" header to the request. You can do the same thing in Java SDK v2 by setting a overrideConfiguration in the PutObject request builder.

        PutObjectRequest request = PutObjectRequest.builder()
                .bucket(BUCKET)
                .key(KEY)
                .overrideConfiguration(AwsRequestOverrideConfiguration.builder()
                        .putHeader("x-amz-website-redirect-location", URL)
                        .build())
                .build();

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@debora-ito
Comment options

Answer selected by boaks
@debora-ito
Comment options

@boaks
Comment options

@debora-ito
Comment options

@boaks
Comment options

Comment options

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
2 participants