I want to be able to do resumable uploads to Google Cloud Storage in a node.js client application using the gcs-resumable-upload package, in conjunction with signed urls (since the client app is invoked by unauthenticated users).
My server generates a signed url by calling getSignedUrl with {action: 'resumable'}
. The server then sends a POST to the signed url with header { 'x-goog-resumable': 'start' }
and an empty body, and receives a response with a location
header that looks something like the following:
https://storage.googleapis.com/<bucket_name/<file_path>?GoogleAccessId=<service_account>&Expires=<expiry_time>&Signature=<signature>&upload_id=<upload_id>
My question is: If I return the above location
header to my client, can the client use it to perform a resumable upload using gcs-resumable-upload, and if so, how exactly? If anyone has an example, that would be greatly appreciated!
If you are using java then.
According to the google doc here It is clear how to create a signed URL to upload the object to a bucket.
But you need to add an extra header for resumable upload ("x-goog-resumable: start"). which is not mentioned in the doc.
Now use the location to make a PUT call to upload the object. For more info on which headers to use on interruption see link