Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

firefox webgl unity load build error (chrome/brave is fine)

Discussion in 'WebGL' started by duartedd, Jan 11, 2022.

  1. duartedd

    duartedd

    Joined:
    Aug 1, 2017
    Posts:
    148
    I am having trouble getting firefox to load up my game - anyone able to help me out - here is my .htaccess file:

    # This configuration file should be uploaded to the server as "<Game Folder>/Build/.htaccess"
    # This configuration has been tested with Unity 2020.1 builds, hosted on Apache/2.4
    # NOTE: "mod_mime" Apache module must be enabled for this configuration to work.

    <IfModule mod_mime.c>
    # The following lines are required for builds without decompression fallback, compressed with gzip
    RemoveType .gz
    AddEncoding gzip .gz
    AddType application/octet-stream .data.gz
    AddType application/wasm .wasm.gz
    AddType application/javascript .js.gz
    AddType application/octet-stream .symbols.json.gz
    # The following lines are required for builds without decompression fallback, compressed with brotli
    RemoveType .br
    RemoveLanguage .br
    AddEncoding br .br
    AddType application/octet-stream .data.br
    AddType application/wasm .wasm.br
    AddType application/javascript .js.br
    AddType application/octet-stream .symbols.json.br
    # The following line improves loading performance for uncompressed builds
    AddType application/wasm .wasm
    # Uncomment the following line to improve loading performance for gzip-compressed builds with decompression fallback
    AddEncoding gzip .unityweb
    # Uncomment the following line to improve loading performance for brotli-compressed builds with decompression fallback
    AddEncoding br .unityweb
    </IfModule>





    and the webpage i am trying to load it on:
    https://vaultsgame.com/Launch

    the error:
    Failed to download file Build/WebGLVaults.data.unityweb

    and then i get
    Uncaught (in promise) TypeError: e is undefined <---- this one might be related to the first error so I am focusing on that one...

    I tried different clearing the browser data/cache, commenting out stuff and retrying and copying that file to the build directory as well. Same issue

    Chrome/Brave work without issue.
     
  2. duartedd

    duartedd

    Joined:
    Aug 1, 2017
    Posts:
    148
    i saw an error about brotli not liking http (requires https) - which my site is using https and it works fine in chrome in brave - but after removing brotli compression - issue is fixed - i then tried gzip compression - and it didnt work (but still worked in chrome/brave) until i had to comment out ' AddEncoding br .unityweb '

    tried to do the reverse for brotli - rebuilt - reuploaded - commented out
    AddEncoding gzip .unityweb
    and uncommented out
    AddEncoding br .unityweb

    still no dice - same deal - same error pointing to http instead of https instead of the issue....which its a https website so not sure whats up with that...

    for now its on gzip compression and working - if anyone wants to test it out and is curious to help figure out what is up with Brotli -
    try this location:
    https://vaultsgame.com/Staging
     
  3. aureliendu3809

    aureliendu3809

    Joined:
    May 4, 2022
    Posts:
    1
    Hello, I had the same problem and found a solution.

    Problem: firefox can't download the "data.br" file but the download works on all other browsers.
    But with the Unity link the webgl works on firefox

    Solution:
    I checked the Unity header and added all headers line by line in my apache config (or in .htacces in webgl project).

    And I found what we need to do so that firefox can download it:

    <IfModule mod_mime.c>

    # ( And I have place here like you all AddEncoding,AddType,RemoveType,..... for Gzip and brotli)


    #You need Add :

    <FilesMatch "\.data\.br$">
    Header set Content-Type: text/html
    </FilesMatch>
    </IfModule>
     
    madrobotMK likes this.
  4. camjackson1

    camjackson1

    Joined:
    May 31, 2022
    Posts:
    1
    Thanks @aureliendu3809 that did it. I'm not using Apache so the fix was slightly different for me, but yes, the solution is that the `data.br` file must be served with `Content-Type: text/html`.