3
votes

I host my static site on google cloud storage.

My files without gzip compression make my site work perfectly.

When I gzip my files locally (with gzip -r folder) prior to upload to my cloud storage bucket and run following command, my whole site breaks (images, js, css, all broken - no style information found warning etc.)

gsutil -m -h content-encoding:gzip rsync -c -r ~/my-gzipped-folder gs://example.com

Why the error and how to fix?

2
If I understand correctly, then decompressive transcoding is enabled somehow and that causes my site to break. To prevent/disable the transcoding I used gsutil setmeta -h cache-control:no-transform gs://example.com/* (right after my above rsync code with the content-encoding:gzip) but the setmeta command did not work, it did nothing.user10698660

2 Answers

3
votes

I think the answer to your question may be lying here.

There are two ways to prevent decompressive transcoding from occurring:

If the request for the object includes an Accept-Encoding: gzip header, the object is served as-is in that specific request, along with a Content-Encoding: gzip response header.

If the Cache-Control metadata field for the object is set to no-transform, the object is served as a compressed object in all subsequent requests, regardless of any Accept-Encoding request headers.

2
votes

Seems I just had to upload my gzipped files without the .gz extension and then all good.