需要帮助来了解Firebase Storage CDN [英] Need help understanding the Firebase Storage CDN

查看:94
本文介绍了需要帮助来了解Firebase Storage CDN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个有声书应用程序,并且已将音频文件上传到Firebase Storage。我的问题是,在旧金山和多伦多,我经历了不同的表演。我的印象是Firebase Storage内置了CDN。如果是这样,我需要在某个地方启用它吗?如果没有,如何将GCP CDN添加到Firebase身份验证后面的Firebase存储文件中?



检查域 storage.googleapis.com (托管我的Firebase存储文件的位置)显示它正在使用Google CDN。



以下是我的一个公共音频文件请求的响应标头:

 接受范围:字节
alt-svc:quic =:443; ma = 2592000; v = 46,44,43,39
缓存控制:公共,最大年龄= 3600
content-disposition:内联; filename * = utf-8''G4PT7dPIyEuIz74BtTmm_FallIsTheLastSeasonOfTheYear.mp3
content-length:3162637
content-type:audio / mp3
date:Tue,30 Apr 2019 17:13:34 GMT
etag: 98013599e6f108a0edeeaac7c8b2bb45
到期:2019年4月30日,星期二18:13:34 GMT
最后修改时间:2019年4月8日,星期一17:59:58 GMT
服务器:UploadServer
状态:200
x-goog代: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存储的内容长度:3162637
x-guploader-uploadid:AEnB2UqdvgzkJMC0yHJkGbr-K5cWWbXK5I2j6NLtd4NwG1G9swIhhp1QC8G25JUK4LItZID0ta



$ b div class = h2_lin>解决方案

我联系了Firebase支持,这是我得到的答案:


关于CDN问题,简短的回答是否,Cloud Storage没有内置CDN;较短的答案是:当您的Cloud Storage
是多区域时,这意味着热门内容(经常访问的
内容)可在不同位置使用,但仅限于
多区域位置,它仅适用于
位置的管辖权,因此,例如,如果您的项目位于我们中心,则
则为多区域存储将仅存储在美国数据
中心,因此从多伦多访问时,将从最近的美国数据中心
提供服务。



现在,有一些方法可以将CDN添加到Cloud Storage内容中;我使用Google CDN找到了
这个小指南:
https://medium.com/@marco_37432/create-a-custom-domain-cdn-with-google-beta-7ad9531dfbae



我看到的另一个用途是使用Cloud
Storage创建一个静态网站,并在其上添加另一个CDN提供程序,例如CloudFlare。您
可以在此链接中查看更多详细信息:



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



I'm building an audiobook app and have uploaded the audio files on Firebase Storage. My problem is that I experience different performances in San Francisco vs Toronto. I am under the impression that Firebase Storage has built-in CDN. if so, Do I need to enable it somewhere? if not, how do I add GCP CDN to my Firebase Storage files behind Firebase Auth??

Checking the domain storage.googleapis.com which is where my Firebase Storage files are hosted shows that it is using the Google CDN.

Here are the response headers for one of my public audio file request:

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

解决方案

I reached out to Firebase Support and here is the answer I got:

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 Storage CDN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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