I want site users to be able to upload files to google cloud storage without using web application resources, so signed URLs look like a way.
When the user selects the file to download jquery , it sends a GET request to django for the signed URL. The URL is created using the gsutil signurl . django then returns the signed URL to the template and sends a jquery PUT request with the signed URL.
However:
- PUT request does not work with 'SignatureDoesNotMatch'.
- GET requests for storage objects operate using this method.
Are headers required to be sent with a PUT request required?
gsutil command (assuming the user has selected the file 'map.html') ...
gsutil signurl -p notasecret -m PUT -d 10m /path/to/.p12 gs://bucket_name/map.html
jquery put code ...
$.ajax( { url: g_url, type: 'PUT', crossDomain: true, success: console.log('success'), error: function(XMLHttpRequest, textStatus, errorThrown){ alert('status:' + XMLHttpRequest.status + ', status text: ' + XMLHttpRequest.statusText); }, data: file, } );
g_url looks like ...
https://storage.googleapis.com/bucket_name/map.html?GoogleAccessId=__retracted__&Expires=1408889274&Signature=rDJAZQG4MIyMupy0M8HJ17r8rkEJcAbYSWpcq084SdzRh%2BnZavTfuWl4Q%2F6ytkSkN2c2%2B4b4pPRF5eWOEOL1InRxlB5pEBedPFZPpgDrRvR9tFybtH%2BkesKLhIZ3WjJ0utzAwhl%2BgAlQY6ulvO0Djib20zcG5fkHOigpRf1xBUk%3D
source share