1
votes

How can I cache assets stored on google cloud storage (GCS)? I've been trying to make it work in the past 2 days with no luck. My website have backend & frontend, and the asset is stored on GCS. I tried the following guide:

a. https://support.cloudflare.com/hc/en-us/articles/200168926-How-do-I-use-Cloudflare-with-Amazon-s-S3-Service-

b. https://cloud.google.com/storage/docs/hosting-static-website

c. https://cloud.google.com/storage/docs/static-website#tip-dynamic

Let say my website is example.com, here's what I did:

  1. I created a bucket on GCS "img.example.com"

  2. On Cloudflare I set CNAME with the following: Name: img.example.com Value: c.storage.googleapis.com

  3. I set all object in GCS bucket 'readable by public' (https://cloud.google.com/storage/docs/access-control/making-data-public#buckets)

The image is still not cached by Cloudflare and the header status still not showing CF-Status. Am I missing something? Any help would be greatly appreciated.

Thank you.

1
Can you tell us the real value of img.example.com? The problem is not readily apparent from the description, which sounds like it should work.Michael - sqlbot

1 Answers

0
votes

I changed the link from https://storage.googlesapis.com/subdomain.mysite.com/... to https://subdomain.mysite.com/... (simply removing "storage.googleapis.com") and it works! Hope it helps other that stuck as well.