Headers Gzip - Unity App

Hello,
I’m trying to deploy a unity app that is .gzip but I’m facing an issue when deploying the app : https://melodious-biscotti-444f12.netlify.app/

Unable to parse XXX.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.

Nothing strange in deployment logs.
This is the first time I’m deploying this kind of application, so I could be a newbie mistake, but I’m still not able to understand what’s going on.

The others posts on serving Gzip didn’t solve my issue, that’s why I’m posting this today !

Any help will be appreciate.
Regards,
JF

For anyone trying to solve this kind of error, I solve it by adding a : Netlify.toml file on my source folder, containing this :

[[headers]]
  for = "/Build/*.data.br"
  [headers.values]
    Content-Encoding = "br"
    Content-Type = "application/octet-stream"
	
[[headers]]
  for = "/Build/*.wasm.br"
  [headers.values]
    Content-Encoding = "br"
    Content-Type = "application/wasm"

[[headers]]                                                                      
  for = "/Build/*.js"                                                             
  [headers.values]
    Content-Encoding = "js"
    Content-Type = "application/javascript"
	
[[headers]]                                                                      
  for = "/Build/*.js.br"                                                             
  [headers.values]
    Content-Encoding = "br"
    Content-Type = "application/javascript"

Hopefully it will save you some time !

2 Likes

Thanks for sharing the solution, @jilief ! This will help others who run into the issue :slight_smile:

1 Like

Hi, @jilief. I know someone from the support team already replied here but this is so great that I wanted to also say thank you.

I might have to suggested not compressing it at all as our service will do so automatically. However, if you already have the precompressed files (and it seems you do), this is an awesome solution.

Thank you again for sharing that here.

1 Like