Search Unity

uncaught exception: unknown compression method

Discussion in 'WebGL' started by monark, Dec 11, 2015.

  1. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Just trying out the new 5.3 version of WebGL and think we have everything configured right on the server, .jsgz, .memgz, .datagz mime types all setup and compression enabled (IIS server setup)
    But when loading the files I get this error

    Any ideas on what would cause that and how to fix it?

    Get the same error in Chrome, Firefox and Edge

    Get the same error too with compression turned off for the server, which I thought would at least force Unity to use it's own decompression code...
     
    Last edited: Dec 11, 2015
  2. zmobchomper

    zmobchomper

    Joined:
    Oct 12, 2012
    Posts:
    2
    Same issue here. Any help would be appreciated.

    I've made builds that work (and continue to work) with Unity 5.2.3. Unity 5.3 builds, however, only work locally. Running them from the webserver does not. I am running Apache 2.4.16.
     
  3. zmobchomper

    zmobchomper

    Joined:
    Oct 12, 2012
    Posts:
    2
    Double post because I solved the problem:

    Lots of fiddling and restarting Apache until it finally started working. Monark, I would suggest restarting your server a few times and ensuring that the conf files are correct. Though I had set the MIME types correctly, my webserver wouldn't pick up the changes until the last restart I did.

    For anyone else with an Apache issue...

    If your server is configured to allow .htaccess in the directories around your Unity WebGL build simply create/add to your .htaccess the following lines (not csharp ;P)

    Code (csharp):
    1. AddType application/octet-stream .memgz .datagz .unity3dgz
    2. AddType application/javascript .jsgz
    If you'd rather not create an .htaccess file or your Apache isn't configured to use them, you can always set the MIME types globally. The process seems a bit more involved but it's not too bad.

    First, let's find your httpd location. With Apache running
    $ ps -ef | grep apache
    You should see a path like "/usr/sbin/httpd"
    Then, let's find your root http location:
    $ /usr/sbin/httpd -V | grep HTTPD_ROOT
    And then finally the conf file itself:
    $ /usr/sbin/httpd -V | grep SERVER_CONFIG_FILE

    Find the right spot to add the lines I showed above. Finally, restart Apache. Maybe a couple of times. I had to do it quite a few times.

    Thanks to Lareieli for pointing out the correct types! http://forum.unity3d.com/threads/webgl-not-working.307800/#post-2419319
     
    Last edited: Dec 11, 2015
    ironbellystudios likes this.
  4. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Hmmm still doesn't work.
    I'm getting a 404 error on this file

    TemplateCompressed/UnityProgress.jsgz

    Which indeed does not exist, though the uncompressed one does
    TemplateData/UnityProgress.js

    There appears to be nothing even trying to load the gz one only the .js one
    <script src="TemplateData/UnityProgress.js"></script>

    all very weird...
     
    Last edited: Dec 14, 2015
  5. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    I should add our server is IIS not Apache
     
  6. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
  7. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    hmmm and round in circles, getting that to load by moving it just means that I get errors back on the original gz files again.
     
  8. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    It's loading! hurrah. Needed to move the data files from Release to Compressed for some reason...
     
  9. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,494
    Ah! the Web.config from that other thread redirects them into a Compressed folder... mystery all solved, eveything working.
     
  10. nonlin

    nonlin

    Joined:
    Dec 12, 2013
    Posts:
    34
    What was the solution exactly?
     
  11. BobsledTM

    BobsledTM

    Joined:
    Aug 15, 2014
    Posts:
    8
    Yeah I'm having the same issue. I've tried everything that everyone tried and am having no luck.
     
  12. nonlin

    nonlin

    Joined:
    Dec 12, 2013
    Posts:
    34
    BobsledTM I'm getting Incorrect Header what is your issue?
     
  13. BobsledTM

    BobsledTM

    Joined:
    Aug 15, 2014
    Posts:
    8
    Same... uncaught exception: incorrect header check
    I've been trying to change the .htaccess file like everyone else is saying, but it doesn't seem to help. I'm still getting the warning in the console "Decompressed Release/Flockers.datagz in 187ms. You can remove this delay if you configure your web server to host files using gzip compression." But my server is using gzip compression (I checked using some websites that do that kind of check/ godaddy says gzip compression is on by default)... So I'm real stumped now.
     
  14. nonlin

    nonlin

    Joined:
    Dec 12, 2013
    Posts:
    34
    Not only that I had this running on my web host before on 5.2. Also when I built the web app with Data Cache on I'd get the error. Now I cleared cached and disabled it and it just stops responding!

    Now I'm allocating more memory and uploading again to give that a try.

    Not sure what is going on.

    Think I just got it working in FireFox. Chrome still stops responding thought. Maybe I need to allocate more memory.

    So again if you can try, disable Data Cache and allocate more memory.
     
    Last edited: Dec 16, 2015
  15. BobsledTM

    BobsledTM

    Joined:
    Aug 15, 2014
    Posts:
    8
    So I just did some gross stuff and got something working. I continued to clear the cache like you said, then I modified the html file where it says dataUrl, codeUrl, and memUrl by adding a gz to the end of all of the paths. After that I deleted the .htaccess. I'm assuming what I just did was get it working by not using gz compression. I don't think this is a legit solution, but I suppose this is what I'm going to have to get this working in the meantime.
     
  16. BobsledTM

    BobsledTM

    Joined:
    Aug 15, 2014
    Posts:
    8
    Ok, now it's not working. No idea what's going on.
     
  17. nonlin

    nonlin

    Joined:
    Dec 12, 2013
    Posts:
    34
    I think I'd keep the .htaccess.

    You had no luck just disabling the data cache? Try other browsers as well.

    Like for some odd reason it won't run on my chrome AT ALL! no matter what. But it ran on my friends computer, in chrome/firefox and it runs on my firefox and it ran on chrome in my mac.
     
  18. BobsledTM

    BobsledTM

    Joined:
    Aug 15, 2014
    Posts:
    8
    Ok, so it wasn't working because I needed to clear out my local cache as well. So frustrating. But yeah, I just removed the htaccess file and then it worked. Unity added auto gzunzipping in case your server wasn't set up to do so, but something was breaking when my server WAS set up to do so. So... yeah, I'll just keep the htaccess file out until I hear of a better solution/the problem gets fixed.
     
  19. nonlin

    nonlin

    Joined:
    Dec 12, 2013
    Posts:
    34
    Oh I didn't know that! So it will unzip with out the .htaccess! I'll have to try!

    Also I hope cache clearing isn't required for every user >_<

    Did you remove ever .htaccess file including the ones in the sub folders or just the root?
    Because it isn't loading for me after removing them all. Are there any extra steps?

    EDIT, nvm seems to have loaded, although the progress bar wasn't updating!

    Also did you keep data cache enabled when building?
     
  20. BobsledTM

    BobsledTM

    Joined:
    Aug 15, 2014
    Posts:
    8
    Yeah Unity does an auto-unzip but that's what causes the progress bar to act strange and freeze.

    I didn't remove the htaccess from the higher levels, just at the release level.

    As for data caching, I'm using GoDaddy managed wordpress as my host so I don't have the ability to turn caching off, I can only clear the cache. I tried fiddling with the .htaccess at the higher level to turn caching off for the specific page, but I had no luck as it still seems to be caching.
     
    Dustyroom likes this.
  21. nonlin

    nonlin

    Joined:
    Dec 12, 2013
    Posts:
    34
    I think caching is perhaps native to the browser. You might have to mess with chrome settings to prevent a site from saving on your computer. Still I'm glad you figured it out. I removed all .htaccess but its good to know its just the one under release that counts.

    Thanks for sharing the quick fix!
     
  22. meirlebel

    meirlebel

    Joined:
    Dec 19, 2015
    Posts:
    1
  23. ironfiftynine

    ironfiftynine

    Joined:
    Jan 22, 2013
    Posts:
    56
    I got the same exception (uncaught exception: unknown compression method) and tried zmobchomper's solution, adding the two lines in the conf file. I can't use the .htaccess since it seems not enabled in Amazon EC2 Apache server. Somehow it got fixed in Firefox but the exception is still present in Chrome. Do I also have to include the contents of .htaccess file created in the WebGL build to the server's conf file? I tried it but it doesn't seem to work, unless I have to restart the server a few times again.
     
  24. Bogdashkin

    Bogdashkin

    Joined:
    Nov 22, 2015
    Posts:
    3
    Just leave it here - workes for me perfectly (in .htaccess in Release folder):
    PHP:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase 
    /WebFolderName/      // <- the name of folder you choose when buil webgl project!
    RewriteCond %{HTTP:Accept-encodinggzip
    RewriteCond 
    %{REQUEST_FILENAME}gz -f
    RewriteRule 
    ^(.*)\.js$ $1\.jsgz [L]

    RewriteCond %{HTTP:Accept-encodinggzip
    RewriteCond 
    %{REQUEST_FILENAME}gz -f
    RewriteRule 
    ^(.*)\.data$ $1\.datagz [L]

    RewriteCond %{HTTP:Accept-encodinggzip
    RewriteCond 
    %{REQUEST_FILENAME}gz -f
    RewriteRule 
    ^(.*)\.mem$ $1\.memgz [L]

    RewriteCond %{HTTP:Accept-encodinggzip
    RewriteCond 
    %{REQUEST_FILENAME}gz -f
    RewriteRule 
    ^(.*)\.unity3d$ $1\.unity3dgz [L]

    AddEncoding gzip .jsgz
    AddEncoding gzip 
    .datagz
    AddEncoding gzip 
    .memgz
    AddEncoding gzip 
    .unity3dgz
     
  25. ironfiftynine

    ironfiftynine

    Joined:
    Jan 22, 2013
    Posts:
    56
    I just moved the .htaccess to /var/www/html and it seems to be working now. Guess I just have to sleep over it to find a solution.
     
    Anisoropos likes this.
  26. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    63
    The RewriteBase fix worked for me. Thanks :)
     
    Bogdashkin likes this.
  27. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    114
    I am running into the exact same issue(s).
    Placing the htaccess file next to the index.html file and implementing the RewriteBase fix makes everything work for me.

    However, I can't really accept that this is the way we should setup our projects. This is a workaround.
    Why doesn't it work with the structure and setup Unity creates on building the project?
     
  28. Dustyroom

    Dustyroom

    Joined:
    Sep 23, 2015
    Posts:
    65
    Can you please give a short step-by-step instructions? I also use GoDaddy Managed Wordpress and can't make WebGL builds to work since 5.3. What is your final .htaccess and in which folder is it?

     
  29. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    317
    Hello Dustyroom.

    Try to upload the 5.3 build to your server and delete the Release/.htaccess file. Normally your 5.3 build should work fine then.
     
    Anisoropos likes this.
  30. Dustyroom

    Dustyroom

    Joined:
    Sep 23, 2015
    Posts:
    65
    That worked perfectly, thank you!
     
  31. thanhvan-t-le

    thanhvan-t-le

    Joined:
    Feb 20, 2016
    Posts:
    2
    hi, i'm running unity 5.3.2 and have generated/uploaded a very simple webGL build to an amazon ec2 instance and i keep getting the "unknown compression method" error. i've tried editing the httpd.conf file and restarting apache, editing the .htaccess file, moving it up to the parent folder and deleting it from the release folder, etc. but nothing has worked so far. any help would be greatly appreciated.
     
  32. rwetzold

    rwetzold

    Joined:
    Oct 10, 2013
    Posts:
    225
    I get the same error and my webhoster does not support gzip (no kidding). How can I upload WebGL content there? Can I somehow deactivate the whole compression magic? I have another project produced with Unity 5.0 or 5.1 and there I have both a release and a compressed folder and that project works nicely. In the 5.4 output I only have a release folder with compressed artifacts. These work locally but not from my hoster.
     
  33. thanhvan-t-le

    thanhvan-t-le

    Joined:
    Feb 20, 2016
    Posts:
    2
    sounds like the same problem as me.. any luck?
     
  34. Pauleta

    Pauleta

    Joined:
    Aug 8, 2013
    Posts:
    17
    Same here. Unity 5.3.2. Not working. Tried everything that was described in this post.
     
  35. Stefanie-Nobel

    Stefanie-Nobel

    Joined:
    Feb 22, 2016
    Posts:
    1
    I got the same problem with Unity 5.3.2p3 in the beginning.

    But then I found a way around the .htaccess.

    I left the .htaccess in the release folder, commented everything out, like the following....

    Options +FollowSymLinks
    #RewriteEngine on

    #RewriteCond %{HTTP:Accept-encoding} gzip
    #RewriteCond %{REQUEST_FILENAME}gz -f
    #RewriteRule ^(.*)\.js$ $1\.jsgz [L]
    ....

    and made a direct reference to the compressed files in the index.html

    var Module = {
    TOTAL_MEMORY: 536870912,
    errorhandler: null,
    compatibilitycheck: null,
    dataUrl: "Release/20160222_1.datagz",
    codeUrl: "Release/20160222_1.jsgz",
    memUrl: "Release/20160222_1.memgz",
    };

    Now, it's working. Hope it helps!
     
    Storyteller, kocetoo and omelchor like this.
  36. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    63
    Hi Alex,
    I tried this and it worked... almost.
    The game starts and everything, but when I try to use PlayerPrefs it does not work unless I put back in the .htaccess with the RewriteBase modification.
     
  37. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    317
    This should not be related.
    Could you upload exactly the same build to different folders on the same server, one build with .htaccess and another without .htaccess, and confirm that after launch they behave differently (for example PlayerPrefs or any other functionality works differently)?
     
  38. rwetzold

    rwetzold

    Joined:
    Oct 10, 2013
    Posts:
    225
    Thanks a lot! That did the trick.
     
    omelchor likes this.
  39. omelchor

    omelchor

    Joined:
    Jun 15, 2011
    Posts:
    19
  40. hheeb

    hheeb

    Joined:
    Mar 28, 2016
    Posts:
    1
    A quick and dirty method to make it work is to uncompress the files ending in "gz"
     
  41. Julien-Lynge

    Julien-Lynge

    Joined:
    Nov 5, 2010
    Posts:
    122
    Tried @Stefanie Nobel's idea, without any luck.

    I commented out all the Rewrite* lines from htaccess, and tried it with and without the AddEncoding stuff at the end commented. I modified index.html to point directly at the *.*gz files, instead of the base js/data/mem files. Regardless of what I try, I get the following error:

    Invoking error handler due to
    Uncaught SyntaxError: Unexpected token ILLEGAL

    For those that got it working, was there anything else you did?
     
  42. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    317
    Hello Julien.Lynge.

    Could you try to undo all the previous changes to the server configuration and upload a fresh build once again, then just remove the Release/.htaccess file. Just in case, which version of Unity are you using and what kind of server (apache/IIS)?
     
  43. Storyteller

    Storyteller

    Joined:
    May 15, 2012
    Posts:
    23
    All I did, was add the 'gz' to the end of the files there in bold, I made no other changes anywhere.
    This worked for me. Im on a fairly common shared webhost running linux. I have a 'regular ole webpage' hosting account, so not a lot of high level control. This fix works fine.
     
  44. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    234
    @alexsuvorov ,
    Hi i uploaded the webgl build to amazon AWS without any changes and it works perfectly with public link but when i use the same for facebook canvas app. facebook throws following error.

    MethodNotAllowedThe specified method is not allowed against this resource.POSTOBJECTC11D5873673B92CB2rI7cyfbeq6NmlToUxIhz2QUtcz1NFby0ZFyUW+5oF3Z18CP6JbaCpnrHYF4TWWzArCT9v9Hf+w=

    What does this mean ?
    Tried removing the .htaccess file but no luck.
     
  45. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    317
    Hello sathya.

    Could you be more specific about the issue details? This seems like an AWS response. Does it appear before the game launch (i.e. when WebGL content is being loaded) or after (i.e. when your code is making requests to the server)? Can you provide the link?
     
  46. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    234
    Hi,
    I get mentioned error before the canvas loads. In facts Facebook iFrame shows only that error. Sorry removed the directory and link is broke. Did you get this working in any facebook game that is hosted in Amazon AWS.
     
  47. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    317
    I don't have much experience specific to AWS+FB, however I assume this should work. Would it be possible for you to create a repro case, let's say just an empty project, that works well when accessed from AWS, but throws an error when loaded from FB iframe?
     
  48. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    234
    Hi,
    Sharing you one webgl game hosted on AWS S3. Link works fine when you use it outside facebook but does not work wtih facebook.. Sent you the link in private conversation
     
  49. sihame

    sihame

    Joined:
    Jul 21, 2015
    Posts:
    7
    Hello,
    In my case I have everything working on my server. I build with Unity 5.3.3 and it works fine.
    I delivered the same build to my client, he has the exception "Unkown compression methode".
    I thought it was because his server is not configured to handle the compression. So I deleted the configuration on my local server in order to have Unity handling the compression as my client. It works fine for me and I juste have the console log : "Decompressed WebGL.js in 305ms. You can remove this delay if you configure your web server to host files using gzip compression." That log my client didn't have it.
    So my questions are :
    - What is the methode of compression that is unknown?
    - Why we have the same prject and it is decompressed on UnityLoader.js on both sides and it work just on my side.

    Thanks for reply.

    I also see on request that my client get the three gzip files : Project.jsgz + Project.memgz + Project.datagz. Just like me.

    Also, we delivered to my client the same project build on Unity 5.2 and it worked for him. Juste the build on Unity 5.3.3 that does'nt work.

    I just did some tests and get with the information that when I GET project.jsgz from my client, that file is deziped but it has the extension (gz), same for project.memgz and project.datagz.
    So I guess it's a problem with my client's server that it give a deziped file withgz extension from a ziped file build by unity 5.3.3.
     
    Last edited: Sep 20, 2016
  50. Magic73

    Magic73

    Joined:
    Jun 23, 2015
    Posts:
    84

    Great! This works!!!!! (Unity 5.5.1f1)

    Thank you :)