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

Response headers not adding gzip

Discussion in 'WebGL' started by theBdrive, Dec 1, 2016.

  1. theBdrive

    theBdrive

    Joined:
    May 22, 2015
    Posts:
    20
    Whenever I export a WebGL build with the Gzip option for compression, the response headers in the index file are exported as

    Release/game.data
    Release/game.js
    Release/game.asm.js
    Release/game.mem

    instead of

    Release/game.datagz
    Release/game.jsgz
    Release/game.asm.jsgz
    Release/game.memgz

    so I'm having to manually go in and add the gz to the index after every build. Do I have settings I'm missing somewhere to get it to build with the correct gz in the headers?
     
  2. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    Hello theBdrive.

    The file extensions are absolutely correct. They should not match the generated *gz extensions. You are probably confused by the 404 error in the browser console which you are getting for the missing .mem file (sometimes for .js or .data, depending on the Unity version). This 404 error just informs the loader that server does not perform redirection to the compressed content, and the loader switches to JavaScript decompression fallback (which will append the *gz part). The build should work just fine.

    The initial request to the missing .mem gives you ability to configure your server in such a way that the .memgz will be served instead of the requested .mem with the content-encoding: gzip header appended, so that the decompression can be performed by the browser, which is a bit faster than doing it in JavaScript. This is an optional functionality, so you may just safely ignore the initial 404 error for the .mem file.

    If you want to get rid of this message and make your decompression a little bit faster, you may use the following guide for the server setup: https://forum.unity3d.com/threads/why-was-htaccess-removed-in-5-4.424025/#post-2744442
     
  3. theBdrive

    theBdrive

    Joined:
    May 22, 2015
    Posts:
    20
    Thanks for the quick reply Alex, I added a .htaccess file to my release folder as described in the thread you linked and everything is working fine now without having to change the headers. Thanks again!