Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[5.3] Disable gzip compression of files in Release/ folder

Discussion in 'WebGL' started by insmo, Nov 12, 2015.

  1. insmo

    insmo

    Joined:
    Apr 17, 2015
    Posts:
    12
    How do we disable unity build pipeline applying gzip compression on some the JavaScript files in the Release folder? Is there a build flag which removes this step?
     
    aludev1 likes this.
  2. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    No, there is no way to disable this (unless you make a development build). You can probably find the uncompressed files in the Temp folder of your project after the build, though.

    What is your use case?
     
  3. insmo

    insmo

    Joined:
    Apr 17, 2015
    Posts:
    12
    In our distribution pipeline we don't store compressed files on the storage medium, but let the edge servers deal with the compression dependent on the content-encoding the client accepts. Varnish, NGINX and even caching services as CloudFlare do this for you. It's weird to assume everyone using WebGL build target is distributing the files just the way you have imagined. It would be nice if we could have the uncompressed files back as an option. The Apache rewrite rules and .jsgz files seems rather specialized for one way to solve the distribution problem.

    Cheers,
    Simon.
     
    kkorolz and aludev1 like this.
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    As for "It's weird to assume everyone using WebGL build target is distributing the files just the way you have imagined." - there may be many different ways you can distribute the files, but there are also many people who have been running into issues setting this up in the past - so the reason with the changes in 5.3 (where we no longer output uncompressed files) is to have a setup which provides reasonable results in most cases, without requiring everyone to read their web server manual first. I'd argue that this may be the single biggest cause of user confusion pre 5.3. The main thing about 5.3 is, that when the server is not configured to reroute to the compressed files, the JS code will fall back to downloading the gz files and decompressing them in software.

    This solves the following:
    -When outputting both compressed and uncompressed files as before, we have had to constantly answer the question of "Why is my build XXX MB?" as people would not read the docs.
    -When outputting both compressed and uncompressed files as before, we have had to constantly answer the question of "How do I set up my XYZ web server?" - for which the answer would typically be "Sorry, we don't know either".
    -The Apache rewrite rules are merely a hint, which sets up compression for apache when the user happens to use Apache. For other servers, you can still use other setup, or fall back to having Unity decompress the files itself in JS.

    Also note that when you have the server compress files for you instead of using pre-compressed files, we have seen this lead to servers overloading on CPU resources and dropping requests because of this (this may not be true for your setup, just something to consider, as we've seen this happen before).

    All that said: I understand your use case - and yes, in such a case an option to disable compression for release builds may make sense. We'll gather more feedback and consider it.