Reputation:
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?
Upvotes: 3
Views: 2373
Reputation:
Seems I just had to upload my gzipped files without the .gz
extension and then all good.
Upvotes: 2
Reputation: 4441
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.
Upvotes: 3