Hi all,
I’ve spent the last few days trying to improve load times on my game and I’m consistently getting the following errors in the console logs on Firefox, Safari, and Chrome across 2 different projects:
Failed to load resource: the server responded with a status of 404 (Not Found) when trying to access a .mem file (yes, .mem, not memgz the log says) from the Resources folder.
Decompressed Release/filename.memgz in 156ms. You can remove this delay if you configure your web server to host files using gzip compression.
I get decompress errors for the memgz, jsgz, and datagz files, which prompted me to start hunting a solution for enabling gzip compression on my Ubuntu 14.04 LTS x64 server running Apache2. I’ve tried (on two different servers with different configs):
- Editing the apache2.conf file in /etc/apache2 to include these two lines:
AddType application/octet-stream .memgz .datagz .unity3dgz
AddType application/javascript .js
- Adding these lines to the mime.conf file in mods-enabled:
AddType application/octet-stream .mem .data .datagz .memgz
AddType application/x-javascript .jsgz
- Adding these lines to the deflate.conf file in mods-enabled:
AddOutputFilterByType DEFLATE application/octet-stream
AddOutputFilterByType DEFLATE application/x-gzip
- Doing 1 and 2 in tandem
- Not doing 1 through 4 and creating an .htaccess file like below and placing it in Release
Options +SymLinksIfOwnerMatch<IfModule mod_rewrite.c>
<IfModule mod_mime.c>
RewriteEngine on
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule ^(.*)\.(js|data|mem|unity3d)$ $1.$2gz [L]
AddEncoding gzip .jsgz
AddEncoding gzip .datagz
AddEncoding gzip .memgz
AddEncoding gzip .unity3dgz
</IfModule>
</IfModule>
- Trying either placing .htaccess file like below in Release or build root folder:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /var/www/html/fbcanvas_b32/
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule ^(.*)\.js$ $1\.jsgz [L]
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule ^(.*)\.data$ $1\.datagz [L]
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule ^(.*)\.mem$ $1\.memgz [L]
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule ^(.*)\.unity3d$ $1\.unity3dgz [L]
AddEncoding gzip .jsgz
AddEncoding gzip .datagz
AddEncoding gzip .memgz
AddEncoding gzip .unity3dgz
In all other aspects, the games seem to play fine.
I will readily admit I’m not much of a web host admin so my knowledge on Apache is limited. I do have physical access and root access to the server so I’m down for trying out just about anything, but I’m out of ideas for how to get this working. I really don’t get why it isn’t able to server these gz files decompressed. I can provide builds, links, and apache config files.
Also, the 404 error concerns me a little when it’s looking for the .mem file. The loading seems to stall at that point and that may be contributing to load time slowness.