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!
According to this post, it is possible.
Client requests a signature so it can do a PUT
Your server does creates and returns a signed URL.
Your server makes a POST request to initiate the resumable upload
Your server returns both the URL and the Upload ID to the client
Client does one or more PUTs using the provided URL and Upload ID