simbad332
simbad332

Reputation: 43

Google Cloud Storage Signed URL forced response disposition

Got a problem, using GCS signed url feature (https://cloud.google.com/storage/docs/access-control/signed-urls) and want to force response content disposition.

I've used it once before in the past, but now I cannot seem to get it work and cannot find any documentation about Google deprecating this feature.

My current example url: https://storage.googleapis.com/examplebucket/examplefile.pdf?GoogleAccessId=account&Expires=expire&Signature=xx&response-content-disposition=inline

Signing is working and I can reach the file, just cannot force disposition.

If I upload file as Content-Disposition=attachment, then it wont make it inline and vice versa.

Any ideas?

Upvotes: 4

Views: 4317

Answers (1)

Brandon Yarbrough
Brandon Yarbrough

Reputation: 38379

For signed URLs, the contentDisposition metadata property, if specified, overrides the response-content-disposition query parameter. This is because the response-content-disposition query parameter is not part of the signature, which means that end users could change it.

If you want to specify response-content-disposition in the signed URL, clear the contentDisposition metadata property, and the value in the query parameter will be used.

Upvotes: 7

Related Questions