Google Cloud Certified Associate Cloud Engineer Practice

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the Google Cloud Certified Associate Cloud Engineer Exam with this comprehensive quiz. Ace your test with multiple choice questions, detailed hints, and thorough explanations. Boost your confidence for success!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


How can CORS errors encountered by developers while trying to access assets in a public storage bucket be resolved?

  1. Advise the developers to adjust the CORS configuration inside their code.

  2. Use the gsutil cors set command to set the CORS configuration on the bucket.

  3. Use the gsutil set cors command to set the CORS configuration on the object.

  4. Use the gsutil set cors command to set the CORS configuration on the bucket.

The correct answer is: Use the gsutil cors set command to set the CORS configuration on the bucket.

The correct approach to resolve CORS (Cross-Origin Resource Sharing) errors when developers are trying to access assets in a public storage bucket is to utilize the gsutil cors set command to configure the CORS settings directly on the bucket. CORS is a security feature implemented by web browsers to prevent malicious sites from accessing resources on another domain without permission. When assets in a Google Cloud Storage bucket are accessed from a web application running on a different domain, the browser enforces CORS policies, which might lead to errors if the necessary CORS headers are not set correctly on the storage bucket. By using the gsutil cors set command, you can specify the origins, HTTP methods, and headers that are permitted to access the resources in the storage bucket. This command effectively configures how your bucket handles requests from different origins, thereby allowing developers’ applications to successfully access the assets stored in that bucket without running into CORS errors. The other methods mentioned do not correctly address the need to specifically configure CORS settings on the bucket. Adjustments inside the code would not resolve server-side CORS issues, and using gsutil to set CORS on either an object or incorrectly referencing the placeholder command format for bucket CORS configuration does not fulfill the requirements needed to