How do I limit the download size of Google Cloud Storage?

I want to allow the client (browser) application to upload files directly to Google Cloud Storage while still being able to contain the size of the file the client can upload.

It seems like the best practice is to combine resumable downloads with signed URLs generated by the server with enough credentials (service account).

Is it possible, with a given stream, to limit the file size for a specific signed URL or resumable download ID? This means that Google Cloud Storage will reject a file that exceeds the desired size.

+3


source to share


1 answer


You can limit the signed URL to the exact size allowed by adding the Content-Length canonical extension header . This will result in only orders with the specified exact content length being allowed (and will not allow uploads of uploaded encodings that do not have this header. So you can pass your client in the desired length to a service that provides a signed url which then includes this limit.



0


source







All Articles