So I’ve built a WebGL world. After it builds, Unity opens it for me in a browser, and it works just fine. But for some reason it will not work after I upload it to a folder on my website. The page opens, the file loads to about 90%, and it just hangs there. I have tried it with three different browsers.
I seem to recall having this issue with other WebGL experiments using other programs. Might it have something to do with my hosting site? I use GoDaddy.
I solved it! I went into the settings and disabled file compression. It makes the export about 20 Mb larger, but it works now! For future reference, might there be a way to make it so I don’t need to do that?
If you figure it out, let me know. I’ve wasted the past 4 hours trying to figure out how to get unity webgl gzip compression to work with godaddy and I’m about ready to throw in the towel.
I tried setting optimization to “Compress All Content” in godaddy’s cpanel
So one would think that it should be working… but nope.
“Unable to parse Build/WebGL.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header “Content-Encoding: gzip” present. Check browser Console and Devtools Network tab to debug.”
At this point I guess I’m ready to suck it up and take the 59MB hit.
Check out this thread, as ‘I think’ it is the one that helped me through it.
More towards the end of the thread as I recall…
Here is what I have in the .htaccess in ‘Build’ folder:
# This configuration file should be uploaded to the server as "<Application Folder>/Build/.htaccess"
# This configuration has been tested with Unity 2020.1 builds, hosted on Apache/2.4
# NOTE: "mod_mime" Apache module must be enabled for this configuration to work.
<IfModule mod_mime.c>
# The following lines are required for builds without decompression fallback, compressed with gzip
RemoveType .gz
AddEncoding gzip .gz
AddType application/octet-stream .data.gz
AddType application/wasm .wasm.gz
AddType application/javascript .js.gz
AddType application/octet-stream .symbols.json.gz
# The following lines are required for builds without decompression fallback, compressed with Brotli
# RemoveType .br
# RemoveLanguage .br
# AddEncoding br .br
# AddType application/octet-stream .data.br
# AddType application/wasm .wasm.br
# AddType application/javascript .js.br
# AddType application/octet-stream .symbols.json.br
# The following line improves loading performance for uncompressed builds
# AddType application/wasm .wasm
# Uncomment the following line to improve loading performance for gzip-compressed builds with decompression fallback
# AddEncoding gzip .unityweb
# Uncomment the following line to improve loading performance for brotli-compressed builds with decompression fallback
# AddEncoding br .unityweb
</IfModule>```
And here is what I have in the httpd.conf, in the 'IfModule mime_module' section:
```<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
AddEncoding br .br
AddEncoding x-gzip .gz
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/wasm .wasm
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
# PAC files e.g proxy.pac
AddType application/x-ns-proxy-autoconfig .pac
#used for configuring auto detect setting using DNS
#AddType application/x-ns-proxy-autoconfig .dat
</IfModule>```
Note: Restart the Apache server after the changes.