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

WebGL fail loading on server, what should I ask the server provider?

Discussion in 'WebGL' started by newyellow, Jun 20, 2016.

  1. newyellow

    newyellow

    Joined:
    Jun 5, 2013
    Posts:
    4
    Hi everyone,

    I'm working on a WebGL project.
    I made a release build, it works fine on localhost, but fail loading on server.

    Here is my test project on server
    http://210.201.220.235/spaceman/WebGLTest/

    the default UnityLoader.js is hard to debug, so I reformat the code,
    maybe this one is better for debugging:
    http://210.201.220.235/spaceman/WebGLTestV2/


    I did some research on this topic, and tried some solutions on this post, but still not working:
    http://forum.unity3d.com/threads/webgl-not-working.307800/


    According to the post, this issue is due to server settings.
    I want to write an Email, ask my server provider to help me, but I don't know how to ask.

    So here is my questions:
    1. Which server settings will cause this issue? ( file access? MIME type? )
    2. If I'm asking my server provider for help, how should I ask? (I'm not familiar with server terms)

    Thanks!
     
  2. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    Hello newyellow.
    There is no need to debug the build. The issue is caused by the incorrect server configuration. Your server appends Content-Encoding: gzip header for the files with gz suffix, which it is not supposed to. Did you modify the default .htaccess or make any other changes to the default server configuration?
    P.S. If you are not familiar with the server configuration, just remove all the .htaccess files from the Release folder and up to the root, then the build should launch fine.
     
    Last edited: Jun 21, 2016
  3. newyellow

    newyellow

    Joined:
    Jun 5, 2013
    Posts:
    4
    Thank for your reply!

    I didn't modify the .htaccess, but I'm not sure about the server configuration.
    I'm doing this project for a company who owns the server, so I should tell them to do some setting for Unity.
    But the problem is I don't know how to tell them.

    I tried remove all the .htaccess, but still not working. Any ideas?
     
  4. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    Oh, that is quite simple.
    The issue is not related to WebGL or Unity in general, so let's temporary forget about the game, and now simply test how the files are served from the server.
    1) open Network tab in the Development tools in your browser
    2) access the http://210.201.220.235/spaceman/WebGLTest/Release/WebGLTest.memgz resource directly from your browser address line, you will then see in the profiler:
    Screen Shot 2016-06-23 at 14.06.55.png
    So, as you can see, there is the Content-Encoding: gzip header, which is not supposed to be there. It is not appended by the default server configuration, which means the server configuration has been adjusted. Note that on Apache server configuration is inherited from all the parent folders, usually users have some incorrect configuration in the very root. The task is therefore to undo the configuration changes that append this header.