Firebase Hosting not compressing image files

589 views
Skip to first unread message

Colin McDonnell

unread,
Dec 21, 2017, 10:27:39 PM12/21/17
to Firebase Google Group
Hi there,

My Firebase Hosting project isn't compressing image assets. This SO post says Hosting automatically gzips files, but it's not happening

Here's a sample image: https://dpcspotweb.firebaseapp.com/img/pills.jpeg. Here are the headers of the asset:

HTTP/1.1 200 OK
Server: nginx
Content-Type: image/jpeg
Cache-Control: max-age=3600
Strict-Transport-Security: max-age=31556926; includeSubDomains; preload
ETag: "79cac4008854f4589e18d57564d1226c"
Last-Modified: Fri, 22 Dec 2017 02:20:04 GMT
Content-Length: 102277
Accept-Ranges: bytes
Date: Fri, 22 Dec 2017 03:16:53 GMT
Via: 1.1 varnish
Connection: keep-alive
X-Served-By: cache-dca17738-DCA
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1513912614.715824,VS0,VE1

Any thoughts?

Incidentally, I also would like image compression on Firebase Storage files but I'm not getting that either. (sample link)

Colin

Michael Lehenbauer

unread,
Jan 3, 2018, 10:58:20 PM1/3/18
to Firebase Google Group
Somebody else may be able to chime in more authoritatively, but I believe it's standard practice to avoid gzipping already-compressed files like jpeg images, since the extra layer of compression saves little (try gzipping a jpeg and you'll see), but it still adds extra decompression overhead so it makes things slower over all.

Hope this makes sense,
-Michael

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c5ccbbec-8593-45aa-8a19-2af2d754261f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Memering

unread,
Jan 4, 2018, 12:04:31 AM1/4/18
to fireba...@googlegroups.com
Michael is correct, Firebase Hosting serves most files gzipped, but not image files because in most circumstances gzipping does not provide much if any additional compression.  The most common approach is to compress the images yourself to your liking, you can pick the tradeoffs that make sense for you.  Another option is to serve multiple different sizes and have your application choose which one to load.

As for Firebase Storage my understanding is that if you upload the file gzipped then it will be served gzipped (although you can request the raw file).  If you upload the file with any other compression then you can only get the file the way you uploaded it (Firebase Storage will not try to gzip it for you).

Hope that helps,

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c5ccbbec-8593-45aa-8a19-2af2d754261f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--

Alex Memering | Software Engineer | meme...@google.com
Reply all
Reply to author
Forward
0 new messages