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

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.

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)

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP:Accept-encoding} gzip
RewriteRule (.*)Release(.*)\.js $1Compressed$2\.jsgz [L]
RewriteRule (.*)Release(.*)\.data $1Compressed$2\.datagz [L]
RewriteRule (.*)Release(.*)\.mem $1Compressed$2\.memgz [L]
RewriteRule (.*)Release(.*)\.unity3d $1Compressed$2\.unity3dgz [L]
AddEncoding gzip .jsgz
AddEncoding gzip .datagz
AddEncoding gzip .memgz
AddEncoding gzip .unity3dgz

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.

oh ok, thanks for the info i’ll look into that :slight_smile: