Gzip compression of static files on google cloud storage breaks site












2















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?










share|improve this question























  • 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.

    – proruzi
    Nov 24 '18 at 15:59


















2















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?










share|improve this question























  • 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.

    – proruzi
    Nov 24 '18 at 15:59
















2












2








2








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?










share|improve this question














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?







google-cloud-platform google-cloud-storage gzip gsutil static-site






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 14:12









proruziproruzi

263




263













  • 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.

    – proruzi
    Nov 24 '18 at 15:59





















  • 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.

    – proruzi
    Nov 24 '18 at 15:59



















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.

– proruzi
Nov 24 '18 at 15:59







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.

– proruzi
Nov 24 '18 at 15:59














2 Answers
2






active

oldest

votes


















2














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.







share|improve this answer































    1














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






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459025%2fgzip-compression-of-static-files-on-google-cloud-storage-breaks-site%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      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.







      share|improve this answer




























        2














        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.







        share|improve this answer


























          2












          2








          2







          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.







          share|improve this answer













          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.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 24 '18 at 14:22









          MaximMaxim

          1,506210




          1,506210

























              1














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






              share|improve this answer




























                1














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






                share|improve this answer


























                  1












                  1








                  1







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






                  share|improve this answer













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







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 24 '18 at 22:06









                  proruziproruzi

                  263




                  263






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459025%2fgzip-compression-of-static-files-on-google-cloud-storage-breaks-site%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                      Calculate evaluation metrics using cross_val_predict sklearn

                      Insert data from modal to MySQL (multiple modal on website)