How can I set a Google Cloud Storage object to be publicly visible when uploading it via a signed URL?

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

I'm following this guide and have a solution which is uploading objects to Google Cloud storage using the signed URL and the XML REST API (e.g. curl -v -X POST $URL -F "file=@test.jpg").

Unfortunately, I cannot figure out how to set the ACL on these objects such that they'll be publicly visible. I have tried using the x-goog-acl header (and various capitalizations in both the signed URL and request headers) and the acl query parameter without success.

I assume this must be possible, as it's referenced in the API documentation and all of the client libraries allow you to do this. I have a feeling I'm screwing something up in my URL signing method (even though the header appears in the signed URL: https://storage.googleapis.com/foo/test.jpg?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=STUFF&X-Goog-SignedHeaders=host%3Bx-goog-acl&acl=public-read&MORE-STUFF), but I'm sort of at a loss.

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.