How to generate a presigned URI that allow several HTTP methods (here : GET and HEAD)?

I am using the aws s3 sdk for PHP, where you can easily generate presigned URIs like this :

$cmd = $my_S3Client->getCommand(
    'GetObject', [
        'Bucket' => 'my_bucket',
        'Key' => 'a_file.txt']);
$a_presigned_uri = $my_S3Client
    ->createPresignedRequest($cmd, $lifespan);
    ->getUri();

And this URI will only be queryable with a GET.

Now if I want to create a presigned URI queryable with a HEAD request, I just have to write the same code, but replacing

->getCommand('GetObject', [...])

with

->getCommand('HeadObject', [...])

Both of these work perfectly.

But I would like to be able to generate a presigned URI on which we can request both a GET or a HEAD request. And I don't know how to do this.

(Note: The objective all of this, is that my client could do a HEAD on the URI, in order to know the size of the file before he tries to download it. So if there is a possibility to generate a presigned URI with 'GetObject' and then a way for the user to only retrieve the size of the file from this presigned URI, I'm also appreciating the answer.)


As of now, You can only generate pre-signed URLs for One Object and One Client Method. This may change in future but who knows when.