Christian Hudon
Christian Hudon

Reputation: 1950

Google Cloud Storage and gzip-encoded data when client does not declare gzip support with Accept-Encoding

I'm comparing various options for hosting a static website. Right now I'm hesitating between Google App Engine and Google Cloud Storage.

For App Engine, I know from the documentation that it's possible to have content served compressed only for clients that declare support for this (via the HTTP Accept-Encoding header).

For Cloud Storage, I see that if you upload compressed content and set the Content-Encoding field to "gzip", Cloud Storage will correctly serve it back compressed to clients that declare support for that. My question is, what happens with Cloud Engine when a client does a GET on an object stored with "gzip" content encoding, but the client does not declare support for gzip-compressed data with accept-encoding in its request? Is the data decompressed on the fly (which is what I would hope), or is some kind or error returned, or is the data served compressed anyway (not great)?

Upvotes: 2

Views: 1531

Answers (1)

lot
lot

Reputation: 1070

Indeed you can store objects in Google Cloud Storage with Content-Encoding: gzip. If a subsequent request for this object does not include the Accept-Encoding: gzip header, the object will get decompressed on the fly, yes.

(Sidenote: Content-Encoding should not be confused with Content-Type, e.g., application/gzip, which is always left untouched.)

Upvotes: 6

Related Questions