Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HEAD requests for S3Presigner #5473

Closed
1 of 2 tasks
tmccombs opened this issue Aug 6, 2024 · 2 comments · May be fixed by #5476
Closed
1 of 2 tasks

Support HEAD requests for S3Presigner #5473

tmccombs opened this issue Aug 6, 2024 · 2 comments · May be fixed by #5476
Labels
feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.

Comments

@tmccombs
Copy link

tmccombs commented Aug 6, 2024

Describe the feature

S3Presigner doesn't currently seem to have any API for generating a Presigned URL for a HEAD request.

Please add a method for creating for generating such a URL.

Use Case

I want to generate a head request and a get request for downloading an object from s3. the client makes a head request to poll until the file to download is actually available.

However, there doesn't currently appear to be a way to create a pre-signed s3 request for HEAD requests using the SDK v2 (there was in V1).

Proposed Solution

The most obvious solution would be to add a presignHeadObject method to the S3Presigner class.

Another possibility would be to add a method to S3Presigner that allows you to give it any software.amazon.awssdk.services.s3.model.S3Request and generate a signed url for it. It appears that the current implementation uses a pretty generic private method anyway.

Finally, another solution could be that S3 could allow you to use a HEAD request with a signed GET request. See below.

Other Information

REFC 7231 (http/1.1) states:

The server SHOULD send the same header fields in response to a HEAD request as it would have sent if the request had been a GET

My interpretation of this is that simply changing the method of a request from a GET to a HEAD shouldn't cause a request that would return 200 to return 403 instead.

But I don't know if it is feasible for s3 to change that behavior.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

2.20.68

JDK version used

11.0.24

Operating System and version

Ubuntu 20.04

@tmccombs tmccombs added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 6, 2024
tmccombs added a commit to tmccombs/aws-sdk-java-v2 that referenced this issue Aug 6, 2024
So that you can sign HEAD requests to S3.

Fixes  aws#5473
tmccombs added a commit to tmccombs/aws-sdk-java-v2 that referenced this issue Aug 6, 2024
So that you can sign HEAD requests to S3.

Fixes  aws#5473
@debora-ito
Copy link
Member

This is a duplicate of #5276.

@debora-ito debora-ito closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2024
Copy link

github-actions bot commented Aug 6, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants