I'm using signed URLs in Google Cloud's Cloud CDN to allow access to cached content. The origin is a private Cloud Storage bucket.
whenever I generate a new signed URL for access (with the cached URL remaining the same), all response status codes for every request are 200, and it appears that the origin is being queried for content retrieval on each request.
I want response code 304(get cache from CDN) but, is it possible to configure Cloud CDN to cache responses when the cached URL remains the same, even if a new signed URL is generated each time?
I'm currently investigating Cloud CDN's specifications, but if anyone has knowledge about the above, I would greatly appreciate your insights.
I think you misunderstand what the 304 Not Modified status is for. A 304 status doesn't mean the response was served from Cloud CDN. Rather, a 304 status indicates the web browser already had the most recent version of the resource.
Google Cloud CDN will respond with a 200 OK status on cache hits, and it can serve cache hits even when the signature parameters in an URL vary. You don't need to do anything special to get caching when generating a new signed URL each time. To confirm whether a particular 200 OK response was served from cache, check for the presence of the Age
response header. There's more information at cloud.google.com/cdn/docs/troubleshooting-steps.