Compress with gzip on firebase

2019-07-13 17:21发布

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条回答
贪生不怕死
2楼-- · 2019-07-13 18:06

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.

查看更多
登录 后发表回答