-
Notifications
You must be signed in to change notification settings - Fork 451
Closed
Closed
Copy link
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Hello, I found configuration issues about origin (cors) configuration with beginSignedUploadSession for give the ability to start the resumable upload from client browser.
With debug I found is related to SignedUrlUploader.createResumeUri method.
In fact I try forcing with this and it works
$headers = [
'Content-Type' => $this->contentType,
'Content-Length' => 0,
'x-goog-resumable' => 'start',
'Origin' => '*',
];
From the api documentation (initiating a resumable upload session, point 5)
- If you have enabled Cross-Origin Resource Sharing, an Origin header that you use in subsequent upload requests for the file you are uploading.
Seems nodejs sdk already have some implementation about that.
Currently my work around is:
// step 1 - signedUploadUrl (POST)
$signed_upload_url = $object->signedUploadUrl($signed_upload_url_expire_at, []);
$headers = [
'Content-Length' => 0,
'x-goog-resumable' => 'start',
'Origin' => '*'
];
// step 2 - beginSignedUploadSession (POST)
$httpClient = new GuzzleClient([]);
$response = $httpClient->post($signed_upload_url, [
'headers' => $headers,
]);
if (in_array($response->getStatusCode(), [200, 201])) {
$signed_upload_url = $response->getHeader('Location')[0];
}
// ..
Is it possible to integrate the configuration or get more information about it?
Thanks
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.