Trying to host HTML5 game on Apache server, failing to load blob

We are trying to get our 4.9.2 HTML5 game online on an Apache server. We have tried to follow all instructions we could find as far as setting up the server for hosting aan HTML5 game in a production setting.

No matter what we do, we get this error:
When the browser is trying to load the url with blob:http protocol, it is failing or getting the wrong data from the file resulting in the error “SyntaxError: expected expression, got ‘<’”

(I am posting this on behalf of the person on the team who’s actually dealing with the server. I will try to get more information from him as to how he’s got the server configured. As far as I know, he has not made any changes to the files generated in the build process, so I don’t know why he would be getting a syntax error of all things.)

We have already looked at this thread and it has not solved our problem.

Thanks for any help or advice.

I have updated information on the actual server configuration being used:


I have tried multiple configurations but the most basic is the “default” apache install, installed through apt-get, on an Ubuntu 14.04 server with .htaccess set to

<Directory /var/www>
	AddEncoding gzip gz
</Directory>

Have also tried .htaccess as following

<Files .gz>
	AddEncoding gzip gz
</Files>

HI ,

It is a clean apache install on Ubuntu, with just the one .htaccess edit that is mentioned in the Readme that is generated when the project is built.
We have also tried it with the

 <files *.gz>
 AddType "text/javascript" .gz
 AddEncoding gzip .gz
 </files>

that is posted as the solution in the other thread I linked in the original post, because that thread seemed to be nearly identical to the error we’re getting. I suspect the solution to the problem is some other equally small configuration change, but we are at a loss as to what else to try.

We had not previously tried it with a blank project since our project worked just fine with the HTML5LaunchHelper when testing locally. Today we tried with a blank project and with the default map with the two chairs & table, and got the same problem.

The error appears to be referring to a character inside the blob file itself, as if it is downloading and unzipping the .gz correctly and then erroring on the resulting file somewhere, as far as we can tell.

I followed the linked Getting Started documentation when setting up the project initially, and the project builds and runs locally just fine, but I don’t see anything in the official documentation that relates to deployment.

Did you try the full solution listed on the forum thread linked in the other answerhub post? It can be found here:

Hi ,

We have not heard from you in several days. I am marking this as answered for tracking purposes, if you are still experiencing this error, please comment with the requested information.

We are still in the process of trying out the suggestions in the forum thread you linked and in another post I found somewhere else on the site. As of right now, this problem remains unsolved. I will be responding again with specifics once we verify whether or not any of these new solutions solved our problem.

Hi ,

Have you been able to work through all of the suggestions?

Yes, we have now (finally) tried all of the listed suggestions, and none seem to have worked.

Have you tried to host the project in any other environment, or only on Ubuntu with an Apache server? It would be beneficial to know if this is limited to one specific server type.

We have only tried it with Ubuntu/Apache so far. Might be worth mentioning that it is actually Ubuntu running in a virtual machine, not a separate dedicated computer. That isn’t going to be our final server setup, but we wanted to get something set up to at least be able to test our game/show proof of concept, and setting up an actual, physical server isn’t an option for us yet.

Hi ,

I did a bit of digging and found that the Directory directive is not used in the .htaccess file, so that can be removed. Additionally, remove AddType “text/javascript” .gz

The .htaccess file should be generated on packaging, so you should not have to create one. Additionally, in 4.10, the file extensions have been changed to the following:

.jsgz
.datagz
.memgz
.symbolsgz

These extensions are special cased and help the browser load and run the files properly. These do not include XML encoding. A sample has been provided below:

AddType application/x-javascript .jsgz
AddType application/octet-stream .datagz

RewriteEngine on

If client accepts compressed files

RewriteCond %{HTTP:Accept-Encoding} gzip

and if compressed file exists

RewriteCond %{REQUEST_FILENAME}gz -f

send .ext.gz instead of .ext

RewriteRule ^(.+).(mem|js|data|symbols)$ $1.$2gz

AddEncoding gzip .jsgz
AddEncoding gzip .datagz
AddEncoding gzip .memgz
AddEncoding gzip .symbolsgz

Please let me know if this addresses your error.