需要帮助了解 Firebase 存储 CDN
Need help understanding the Firebase Storage CDN
我正在构建一个有声读物应用程序并已将音频文件上传到 Firebase 存储。我的问题是我在旧金山和多伦多经历了不同的表演。我的印象是 Firebase 存储有 built-in CDN。如果是这样,我需要在某处启用它吗?如果没有,我该如何将 GCP CDN 添加到 Firebase Auth 后面的我的 Firebase 存储文件中?
检查托管我的 Firebase 存储文件的域 storage.googleapis.com
表明它正在使用 Google CDN。
这是我的 public 音频文件请求之一的响应 headers:
accept-ranges: bytes
alt-svc: quic=":443"; ma=2592000; v="46,44,43,39"
cache-control: public, max-age=3600
content-disposition: inline; filename*=utf-8''G4PT7dPIyEuIz74BtTmm_FallIsTheLastSeasonOfTheYear.mp3
content-length: 3162637
content-type: audio/mp3
date: Tue, 30 Apr 2019 17:13:34 GMT
etag: "98013599e6f108a0edeeaac7c8b2bb45"
expires: Tue, 30 Apr 2019 18:13:34 GMT
last-modified: Mon, 08 Apr 2019 17:59:58 GMT
server: UploadServer
status: 200
x-goog-generation: 1554746398034230
x-goog-hash: crc32c=TKSAfA==, md5=mAE1mebxCKDt7qrHyLK7RQ==
x-goog-meta-firebasestoragedownloadtokens: da578546-c265-4f06-ae11-6273a7812bf2
x-goog-metageneration: 2
x-goog-storage-class: STANDARD
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 3162637
x-guploader-uploadid: AEnB2UqdvgzkJMC0yHJkGbr-K5cWWbXK5I2j6NLtd4NwG1G9swIhhp1QC8G25JUK4LItZID0IxuYhhLta3YImMTtzbKkr5vcEQ
我联系了 Firebase 支持,这是我得到的答案:
Regarding the CDN question, the short answer is no, Cloud Storage has no built-in CDN; the less short answer is: when your Cloud Storage
is "multi-regional", it means that "hot content" (frequently accessed
content) is available on different locations, but that is limited to
multi-regional locations, and it applies only to the "jurisdiction" of
the location, so, for example, if your project is in "us-central",
then your multi-regional Storage will be stored only in the US data
centers, so when accessed from Toronto, it will be served from the
nearest US datacenter.
Now, there are ways to add a CDN to Cloud Storage content; I found
this small guide using Google CDN:
https://medium.com/@marco_37432/create-a-custom-domain-cdn-with-google-beta-7ad9531dfbae
Another use that I have seen is creating a static website with Cloud
Storage and adding on top another CDN provider, like CloudFlare. You
can see more details in this links:
https://cloudplatform.googleblog.com/2015/09/push-google-cloud-origin-content-out-to-users.html
https://cloud.google.com/interconnect/docs/how-to/cdn-interconnect
我正在构建一个有声读物应用程序并已将音频文件上传到 Firebase 存储。我的问题是我在旧金山和多伦多经历了不同的表演。我的印象是 Firebase 存储有 built-in CDN。如果是这样,我需要在某处启用它吗?如果没有,我该如何将 GCP CDN 添加到 Firebase Auth 后面的我的 Firebase 存储文件中?
检查托管我的 Firebase 存储文件的域 storage.googleapis.com
表明它正在使用 Google CDN。
这是我的 public 音频文件请求之一的响应 headers:
accept-ranges: bytes
alt-svc: quic=":443"; ma=2592000; v="46,44,43,39"
cache-control: public, max-age=3600
content-disposition: inline; filename*=utf-8''G4PT7dPIyEuIz74BtTmm_FallIsTheLastSeasonOfTheYear.mp3
content-length: 3162637
content-type: audio/mp3
date: Tue, 30 Apr 2019 17:13:34 GMT
etag: "98013599e6f108a0edeeaac7c8b2bb45"
expires: Tue, 30 Apr 2019 18:13:34 GMT
last-modified: Mon, 08 Apr 2019 17:59:58 GMT
server: UploadServer
status: 200
x-goog-generation: 1554746398034230
x-goog-hash: crc32c=TKSAfA==, md5=mAE1mebxCKDt7qrHyLK7RQ==
x-goog-meta-firebasestoragedownloadtokens: da578546-c265-4f06-ae11-6273a7812bf2
x-goog-metageneration: 2
x-goog-storage-class: STANDARD
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 3162637
x-guploader-uploadid: AEnB2UqdvgzkJMC0yHJkGbr-K5cWWbXK5I2j6NLtd4NwG1G9swIhhp1QC8G25JUK4LItZID0IxuYhhLta3YImMTtzbKkr5vcEQ
我联系了 Firebase 支持,这是我得到的答案:
Regarding the CDN question, the short answer is no, Cloud Storage has no built-in CDN; the less short answer is: when your Cloud Storage is "multi-regional", it means that "hot content" (frequently accessed content) is available on different locations, but that is limited to multi-regional locations, and it applies only to the "jurisdiction" of the location, so, for example, if your project is in "us-central", then your multi-regional Storage will be stored only in the US data centers, so when accessed from Toronto, it will be served from the nearest US datacenter.
Now, there are ways to add a CDN to Cloud Storage content; I found this small guide using Google CDN: https://medium.com/@marco_37432/create-a-custom-domain-cdn-with-google-beta-7ad9531dfbae
Another use that I have seen is creating a static website with Cloud Storage and adding on top another CDN provider, like CloudFlare. You can see more details in this links:
https://cloudplatform.googleblog.com/2015/09/push-google-cloud-origin-content-out-to-users.html https://cloud.google.com/interconnect/docs/how-to/cdn-interconnect