Search Unity

WebGL Cannot load asset bundle over https

Discussion in 'Asset Bundles' started by dansav, Apr 9, 2021.

  1. dansav

    dansav

    Joined:
    Sep 22, 2005
    Posts:
    510
    I'm trying to download an asset bundle from a WebGL build. It works fine in the editor.
    When I'm using WebGL it throws a mixed content security error.

    Code (CSharp):
    1. UnityEngine.Networking.UnityWebRequest request
    2.            = UnityEngine.Networking.UnityWebRequestAssetBundle.GetAssetBundle("https://myserver/etc", 0);
    3.        yield return request.Send();
    Even though the url starts with https:// when the error comes back in firefox it says something like
    cannot download mixed content resource at http://myserver/etc. Why is it changing the https to http?

    I turned off the mixed content security in firefox about:config and now it gives CORS security error again with the error at http://myserver/etc not https.

    How do I get past the mixed content security error?

    Also where should I put the asset bundles to avoid CORS problems on the same server?

    Also I tried to switch to Addressables but having no luck there for other reasons which are in another post.
     
    Last edited: Apr 10, 2021
  2. dansav

    dansav

    Joined:
    Sep 22, 2005
    Posts:
    510