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

Compressed filed (GZIP) are all being loaded, except for the .data.gz

Discussion in 'WebGL' started by sluice, Aug 13, 2015.

  1. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    Hello all,

    According to the Unity documentation on WebGL build, you can check if the browser is loading the compressed files by looking at the Content-Encoding in the response headers.



    Now, if I look for Content-Encoding: gzip in my response header, it seems like it is successfully working all of my .js files and the .mem file.



    But, it is not working for the big .data file, here is a capture of the response header for my .data file:




    Any clue why?
    This was tested on a WP-Engine server, the .htaccess file provided by Unity, was placed at the root of the server.
     
  2. AnonDreamer

    AnonDreamer

    Joined:
    Oct 28, 2014
    Posts:
    30
    Hi there, i noticed the same issue when trying to load files from the compressed folder, i have the following files:
    fileloader.js, UnityConfig.js, webGL.html.mem and webGL.js which are correctly loaded from the "compressed folder", whereas:
    webGL.0.data, webGL.1.data and webGL.2.data are loaded from the "release" folder.

    Here is the .htaccess (the default one created with the build)
    Code (CSharp):
    1. Options +FollowSymLinks
    2. RewriteEngine on
    3.  
    4. RewriteCond %{HTTP:Accept-encoding} gzip
    5. RewriteRule (.*)Release(.*)\.js $1Compressed$2\.jsgz [L]
    6. RewriteRule (.*)Release(.*)\.data $1Compressed$2\.datagz [L]
    7. RewriteRule (.*)Release(.*)\.mem $1Compressed$2\.memgz [L]
    8. RewriteRule (.*)Release(.*)\.unity3d $1Compressed$2\.unity3dgz [L]
    9. AddEncoding gzip .jsgz
    10. AddEncoding gzip .datagz
    11. AddEncoding gzip .memgz
    12. AddEncoding gzip .unity3dgz
     
  3. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    After about 2 weeks of back and forth with support from WP-Engine, I managed to make it work.
    I should say "I", very loosely, because they did the work.

    It took them a while to eventually figure it out.

    Let's just say that the htaccess given by Unity works on Apache server, in theory.
    But in practice, every server, depending on the company, have their own custom settings...

    In my case, WP-Engine servers are made using a special recipe. The servers are actually a mix of Apache, Nginx and other things they keep a secret. The rewrite rules from the htaccess were not taken into account, because they are handled by Nginx.

    All of that to say, if your server is running Apache (or a mix of Apache and something else), and the htaccess file given by Unity doesn't work, open a ticket with the support and hopefully after a few days/weeks of back and forth them the problem will be resolved.
     
    Last edited: Sep 22, 2015
  4. AnonDreamer

    AnonDreamer

    Joined:
    Oct 28, 2014
    Posts:
    30
    oh ok, thanks for the info i'll look into that :)