包含未由 Google 服务器编码的预压缩 Brotli 的 HTML 文件
我在 Google 云上托管一个单页静态网站,并尝试在我的 index.html
文件上实现文本压缩。
到目前为止,我所做的就是从 index.html
复制所有缩小的 html 代码,并使用 在线转换器,然后将 Brotli 代码以 index2.html
形式保存在我的存储桶中。最后,我将 index2.html
的 Content-encoding
元值设置为 br
。
然而,尽管我期望如此,当我访问 www.mysite.com/index2.html
地址时,我只在 Chrome 中看到一个空白页面,在 Firefox 中看到“内容编码错误”。
我还使用 gzip 压缩执行了相同的过程,并将 content-encoding
设置为 gzip
,但结果是相同的。我使用了 Google 的以下说明,但它似乎不是很全面。
我做错了什么?
PS 我正在使用带有有效 SSL 的 HTTPS。我还在浏览器中进行了检查,服务器发送了一个标头,其中在 content-encoding
字段中包含 gzip 和 br。
I'm hosting a single page static website on Google cloud and I'm trying to implement text-compression on my index.html
file.
What I've done so far was to copy all my minified html code from index.html
and convert it to Brotli code using an online converter and then saving the Brotli code as index2.html
in my bucket. Finally I set the Content-encoding
meta value of index2.html
to br
.
How ever, despite my expectation, I only see a blank page in Chrome and "Content Encoding Error" in Firefox when i go to the www.mysite.com/index2.html
address.
I also did the same procedure with gzip compression and setting the content-encoding
to gzip
but the results were the same. I used the following instructions by Google but it doesn't seem very comprehensive.
What am I doing wrong?
P.S. I am using HTTPS with a valid SSL. I also ckecked in my browser, and the server sent a header that includes the gzip and br in the content-encoding
field.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它几乎(!)对我有用,但不是我期望的那样,我不清楚为什么。
我在托管网站的存储桶中有一个 (JPEG) 文件
${IMAGE}
。brotli
将brotli
的图像复制回存储桶如果我直接在 Chrome 中浏览该网站,它会失败(取消),没有响应代码:
ERR_CONTENT_DECODING_FAILED
如果我浏览 GCS 公共 URL,它会工作 (200):
https://storage.googleapis.com/${BUCKET}/images/brotli.jpg
以及:
https://storage.cloud.google.com/${BUCKET}/images/brotli.jpg
如果我使用
gzip
而不是brotli
,两者都按预期工作。由于某种原因,我无法浏览作为静态站点一部分的 brotli 压缩文件,即使它确实存在并且我可以通过其他方式浏览 URL。
It almost (!) works for me but not how I expect it to and I'm unclear why.
I have a (JPEG) file
${IMAGE}
in a bucket that's hosting a website.brotli
itbrotli
'd image back to the bucketIf I browse the site directly in Chrome, it fails (canceled) no response code:
ERR_CONTENT_DECODING_FAILED
If I browse the GCS public URL, it works (200):
https://storage.googleapis.com/${BUCKET}/images/brotli.jpg
And:
https://storage.cloud.google.com/${BUCKET}/images/brotli.jpg
If I use
gzip
rather thanbrotli
, both work as expected.For some reason, I'm unable to browse a brotli compressed file as part of the static site even though it's definitively present and I can browse the URL via other means.