Unity builds by default WebGL using brotli. This is fine, but it seems that no webserver ever knows that it needs to respond with Content-Encoding: br
.
This server does that. It will detect when accessing a .br file and respond with the correct content-type and with the encoding set.
Warning
This code is not for production use. It has very little in terms of security and is only designed to verify builds are working.
DO NOT PUBLISH
This is using plain node apis, so usage is very simple:
node server.js
Your file structure should look like:
site/
- server.js
- index.html
- Build/
- site.data.br
- site.framework.js.br
- site.loader.js
- site.wasm.br
- TemplateData/
- style.css
- <other unity template files>
You can use environment variables to configure the server:
PORT=3000 PUBLIC_DIR=public node server.js
which should look like this:
site/
- server.js
- public/
- index.html
- Build/
- site.data.br
- site.framework.js.br
- site.loader.js
- site.wasm.br
- TemplateData/
- style.css
- <other unity template files>
You may want to put everything in public/ for security purposes. But for testing, having it all share server.js is fine. Just dont publish a project like this.
oh yeah, this is licensed under MIT .
Do what you want with it