Quantcast
Channel: Jean-Marc Le Roux
Viewing all articles
Browse latest Browse all 27

Emscripten doesn’t like CloudFlare

$
0
0

In order to make our websites faster and safer, we’re now using CloudFlare on pretty much any of them. It’s fast, reliable and very easy to setup!

Among other things, CloudFlare will cache but also try optimize the content it serves. Mainly JavaScript, CSS and HTML content of course. As you can imagine, Emscripten generated code is not too happy about this, but the problem is not where you would think (ie not in the “optimized” JavaScript files)!

It turns out our server (possibly because of WordPress but I’m not sure) will serve Emscripten’s *.mem files as text/html. Emscripten *.mem files are the program memory init files. You can read more about them in the “Memory Initialization” Emscripten documentation. *.mem files are now generated by default for -O2 and above. Anyway, CloudFlare will try to “optimize” the *.mem files as if they were HTML and break them.

A simple workaround is to disable the HTML optimizations in the “Performance Settings” of the CloudFlare settings for your domain. A more suitable fix would be to configure your web server to serve *.mem files with the application/octet-stream mime-type.


Viewing all articles
Browse latest Browse all 27

Trending Articles