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

Problem with serving gzip and br compressed build in my aws cloudfront nginx server.(Unity Bug)

Discussion in 'WebGL' started by Steven_Damian, Mar 8, 2021.

  1. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65
    From AWS premium service they told me to contact with unity to solve this problem since the origin is not compressing the files(WebGL build)/there is a bug. So i get these messages according to the Content Encoding and my build doesn't load. I see people have the same problem here ( https://forum.unity.com/threads/webgl-build-doesnt-load-in-browser.948400/ ) but they can not solve it. Please, engineers from Unity or everyone else try to give a hand! Thank you!
     

    Attached Files:

    • 22.png
      22.png
      File size:
      26.4 KB
      Views:
      289
    • 33.png
      33.png
      File size:
      26 KB
      Views:
      284
  2. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    376
    Before going further, does the app work when compression is disabled? If so, I highly suggest you look at AWS support forums / stackoverflow and other nginx support mediums.

    Although it might be Unity-related, everything points to server configuration from my perspective. Look at keywords such as "nginx aws brotli configuration". If all fails, maybe look at switching to gzip.

    Might get lucky and get a good samaritain to help you out on this forum but your best bet for quicker resolution is server config troubleshooting, not Unity.
     
  3. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65

    Hello KamilDA! So yes when compression is disabled everything works fine! I have talked with almost 10 technical aws engineers on 1 on 1 videocalls but still they can not figure out the problem and they believe that it's a problem from the side of Unity.
     
  4. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65
    See this screenshot! I added the nginx server with brottli support and i fixed the content encoding but still i get the error message!
    problem.png
     
  5. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    376
  6. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    376
    So, right from the get go, you're missing: "Content-Encoding: gzip" from your response headers on your .gz files.

    That's not a Unity issue, it's a server config issue. I get you're frustrated but you need your server to send that response header.

    I attached an example of a working gzip build served from Azure's Blob Storage as reference.

    Also, I highly recommend you use a more stable version from 2020.x as the beta can bring its own share of issues.
     

    Attached Files:

  7. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65
    The thing is that with 2019 i don't have mobile support so i want at least 2020 version for sure.
     
  8. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65
    Also i tried static website hosting in asure and aws and still the same errors on version 2020 and 2021(beta)
     
  9. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    376
    Link doesn't work.
    • Can you confirm that you are building an empty-ish Unity project (v2020.1+) to test the server configs?
    • Can you confirm you're using the template from 2020 (complete build with default html launcher, not just replacing the .gz / js / data files).

    Edit: @Steven_Damian I just saw your other thread. Seem like indeed it was a server config issue and not a Unity issue. If you can permit me to do give some advise: Please edit previous-posts with extra details instead of new posts if its within a few minutes. This is a forum, not instant messaging. Additionally, please edit your original posts with the solution you found for everyone to know. Right now, going though your post / topic history, in some of those (not all) we don't know what you did to fix your issue and one might still think it's an Unity issue when it's actually a server config issue.
     
    Last edited: Mar 15, 2021
    Steven_Damian likes this.
  10. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65
    Yes exactly. So the solution was that my .htaccess files are not allowed by default in aws ec2 servers. So you should set Allow Override: All (instead of None)