如何使用cloudflare缓存Google云存储(GCS)? [英] How to cache google cloud storage (GCS) with cloudflare?

查看:81
本文介绍了如何使用cloudflare缓存Google云存储(GCS)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何缓存存储在Google云存储(GCS)中的资产?我一直在努力使它在过去2天没有运气.我的网站有后端&前端,并且资产存储在GCS上.我尝试了以下指南:

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. b. https://cloud.google.com/storage/docs/hosting-static-网站

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

假设我的网站是example.com,这就是我所做的:

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

  1. 我在GCS"img.example.com"上创建了一个存储桶

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

在Cloudflare上,我将CNAME设置为以下内容:名称:img.example.com值:c.storage.googleapis.com

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

我将GCS存储桶中的所有对象设置为公众可读"( https://cloud.google.com/storage/docs/access-control/making-data-public#buckets )

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

Cloudflare仍未缓存映像,并且标头状态仍未显示CF状态.我想念什么吗?任何帮助将不胜感激.

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.

谢谢.

推荐答案

我更改了 https://storage.googlesapis.com/subdomain.mysite.com/ ...到 https://subdomain.mysite.com/ ...(只需删除"storage.googleapis.com")即可使用!希望它也可以帮助其他陷入困境的人.

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.

这篇关于如何使用cloudflare缓存Google云存储(GCS)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆