Embedded Unity Game not building, Error message: Brotli compression may not be supported over HTTP connections

So just to test things out for a future project. I created a Unity game which I want to host on my Next.js website. I downloaded with WebGL from Unity and I placed the game files inside the Public folder in my website. I then embedded the game into my website with iframe.

However, this error message is popping up [Error message] https://i.sstatic.net/rUCeBVsk.png

Here is my website structure: [Website Structure]
https://i.sstatic.net/V0DIMpth.png
So far I have

  1. Inserted the game files into my project.
  2. Created a component using iframe to try and display that game.

I am not sure where the issue is or if I need to configure anything further. Any help at all would be appreciated!

Thanks.

1 Answer

1

When enabling Brotli compression it is necessary to configure the server to set the right response headers for content encoding. There are some example server configurations in the Unity Docs: Unity - Manual: Server configuration code samples as a reference. The most important part is to set the header Content-Encoding: br for all files ending with .br and the Content-Type according to the type of the file, e.g., application/wasm for .wasm files, application/javascript for .js files and application/octet-stream for .data and .bundle files.
You can also disable the Content Compression or set it to gzip in the Player Settings\Publishing Settings if your server doesn’t easily support to configure the response headers.