在Firebase托管上提供压缩文件 [英] serving gzipped files on Firebase Hosting

查看:68
本文介绍了在Firebase托管上提供压缩文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用Firebase托管服务提供压缩的html/css/js文件感兴趣.我尝试在firebase.json中设置Content-Encoding标头,但在部署时会出错.

I am interested in serving gzipped html/css/js files using Firebase Hosting. I tried setting the Content-Encoding header in firebase.json, but it errors on deploy.

据称,您可以设置的唯一标头包括:高速缓存控制,访问控制允许原点,与X-UA兼容,X-Content-Type-Options,X-Frame-Options,X-XSS-Protection

purportedly, the only headers you can set include: Cache-Control,Access-Control-Allow-Origin,X-UA-Compatible,X-Content-Type-Options,X-Frame-Options,X-XSS-Protection

那里有什么主意吗?

推荐答案

默认情况下,Firebase托管已经gzip压缩了所有文件.例如,这是我在Firebase上托管的CSS文件的响应标头.请注意Content-Encoding标头:

By default, Firebase Hosting already gzips all of your files. Here, for example, are the response headers for a css file I have hosted on firebase. Note the Content-Encoding header:

Accept-Ranges:bytes
Cache-Control:max-age=7178000
Connection:keep-alive
Content-Encoding:gzip
Content-Length:3483
Content-Type:text/css; charset=utf-8
Date:Sun, 10 Jan 2016 02:09:57 GMT
ETag:"4c94283e07340e9cc0237fc2a349c94d"
Last-Modified:Sun, 10 Jan 2016 00:10:31 GMT
Server:nginx
Strict-Transport-Security:max-age=31556926; includeSubDomains; preload
Vary:Accept-Encoding
Via:1.1 varnish
X-Cache:HIT
X-Cache-Hits:1
X-Powered-By:Express
X-Served-By:cache-lax1432-LAX

这篇关于在Firebase托管上提供压缩文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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