- The code developed in class for the generation of signed URLs can be found on the branch luca-gcs-uploads of the class repository; in particular, the interesting bits are here. This is somewhat non-trivial code, and it's worth making a note of it.
- In the above code, note in particular this line. That header, which will be discussed in Lecture 15, is necessary to enable the API from being accessed from javascript via AJAX by any web site, rather than just the upload-dot-luca-test.appspot.com site where it is hosted.
- One more step was required to make the application accessible from any web site. To add the required CORS header to the GCS bucket, the equivalent of what I did in web2py by adding the header manually, I needed to create this file, and issue the command
gsutil cors set cors_json_file.json gs://luca-teaching-images.
This is described in the following pages, which advanced students should study: - https://cloud.google.com/storage/docs/cross-origin
- https://cloud.google.com/storage/docs/configuring-cors