CLOUD-NETWORK practice question 5 of 30

You have a storage bucket that contains two objects. Cloud CDN is enabled on the bucket, and both objects have been successfully cached. Now you want to make sure that one of the two objects will not be cached anymore, and will always be served to the internet directly from the origin. What should you do?

Full set: 233 questions
Answer options
A: Ensure that the object you don’t want to be cached anymore is not shared publicly.
B: Create a new storage bucket, and move the object you don’t want to be checked anymore inside it. Then edit the bucket setting and enable the private attribute.
C: Add an appropriate lifecycle rule on the storage bucket containing the two objects.
D: Add a Cache-Control entry with value private to the metadata of the object you don’t want to be cached anymore. Invalidate all the previously cached copies. Correct answer
Correct Answer:
D. Add a Cache-Control entry with value private to the metadata of the object you don’t want to be cached anymore. Invalidate all the previously cached copies.
Explanation

Cloud CDN respects the Cache-Control HTTP header to determine an object's cacheability. For objects in Cloud Storage, this header is set via the object's metadata. By adding a Cache-Control: private metadata entry to the specific object, you instruct Cloud CDN and other intermediate caches not to store a copy. The private directive indicates the response is intended for a single user and must not be cached publicly. To ensure this change takes effect immediately and removes any existing cached versions, you must perform a cache invalidation for that object's URL.

Why Incorrect

A. Making an object not public prevents all internet access, which is not the goal. The object should still be servable from the origin.
B. Moving the object to a new private bucket is an unnecessarily complex and indirect way to manage caching for a single object.
C. Cloud Storage lifecycle rules manage object storage class, versioning, and deletion, but they do not control CDN caching behavior.

References

1. Google Cloud Documentation, "Using Cloud CDN with Cloud Storage". Under the section "Cacheability", it states: "The cacheability of a Cloud Storage object depends on its Cache-Control metadata... The Cache-Control metadata for an object determines how long browsers and caches are allowed to cache it."

2. Google Cloud Documentation, "Editing object metadata". This guide shows how to set metadata fields like Cache-Control on an object.

3. Google Cloud Documentation, "Cache invalidation overview". This document explains that invalidation requests "force the removal of content from Cloud CDN's caches" before the normal expiration time.

Scroll to Top