Compress with gzip on firebase

随声附和 提交于 2019-12-10 10:16:09

问题


I'm trying to compress my .css and .js on my firebase hosted web to increase loading speeds, however I've been unable to use the firebase.json config file to correctly setup a gzip compression for my assets.

The curl -v command shows that no compression is performed when serving the files from the server. Also checked in the network section of Firefox Developer edition.

The furthest I've been able to go has been a load error on my browser because of my .json configuration.

"source": "**/*.@(jpg|jpeg|gif|png)",
"headers": [
  {
    "key": "Cache-Control",
    "value": "max-age=7200"
  },
  {
    "key": "Content-Encoding",
    "value": "gzip"
  }
]

This has been my try on the firebase settings resulting in the browser not loading any of the css nor the js.

Any thoughs?

Thanks!


回答1:


Firebase Hosting has a size threshold for compressing files.

All the files that were uncompressed were small (<1K), so they didn't meet that threshold.



来源:https://stackoverflow.com/questions/47895569/compress-with-gzip-on-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!