Search Unity

WebGL, CORS, and Unity Analytics

Discussion in 'Unity Analytics' started by hyperhippo, Apr 2, 2015.

  1. hyperhippo

    hyperhippo

    Joined:
    Jan 16, 2014
    Posts:
    37
    Hello,

    My company has been using GameAnalytics for all our BI for the past year, but it has problems with WebGL so i'm testing integration of UnityAnalytics because you guys state WebGL is supported.

    I find it strange that the very first call from UnityAnalytics.StartSDK, throws a CORS exception from the unity cloud...

    here's the request info from Chrome, you can see a 403 forbidden response...

    1. Remote Address:
      54.192.140.39:443
    2. Request URL:
      https://config.uca.cloud.unity3d.com/ff804760-3b57-40f3-800f-3a8a1f25a948.json
    3. Request Method:
      OPTIONS
    4. Status Code:

      403 Forbidden
    • Response Headersview source
    1. Connection:
      keep-alive
    2. Content-Length:
      689
    3. Content-Type:
      text/html
    4. Date:
      Thu, 02 Apr 2015 18:27:37 GMT
    5. Server:
      CloudFront
    6. Via:
      1.1 ef9db41d50967bc8b7cabdd9c12b11df.cloudfront.net (CloudFront)
    7. X-Amz-Cf-Id:
      ZxQAS9IwHP9KkdEJLk6lxil8vTWt60DmqI2OwncDnWqfo1ulD0a_jg==
    8. X-Cache:
      Error from cloudfront
    • Request Headersview source
    1. Accept:
      */*
    2. Accept-Encoding:
      gzip, deflate, sdch
    3. Accept-Language:
      en-US,en;q=0.8
    4. Access-Control-Request-Headers:
      deviceid, accept, platform, sdk_ver
    5. Access-Control-Request-Method:
      GET
    6. Connection:
      keep-alive
    7. Host:
      config.uca.cloud.unity3d.com
    8. Origin:
      http://localhost
    9. Referer:
      http://localhost/adcap-dev/
    10. User-Agent:
      Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36

    OPTIONS https://config.uca.cloud.unity3d.com/ff804760-3b57-40f3-800f-3a8a1f25a948.json adcap-dev.js:1 _JS_WebRequest_Sendadcap-dev.js:109 vRtadcap-dev.js:109 SJtadcap-dev.js:1 invoke_viiiadcap-dev.js:53 lBfadcap-dev.js:109 rJtadcap-dev.js:1 invoke_viiiiiiiiadcap-dev.js:61 grcadcap-dev.js:109 aLtadcap-dev.js:1 invoke_iiiiiiiiiadcap-dev.js:45 g9dadcap-dev.js:9 dIpadcap-dev.js:9 iIpadcap-dev.js:25 uEgadcap-dev.js:29 VNoadcap-dev.js:29 UNoadcap-dev.js:9 a9padcap-dev.js:109 wKtadcap-dev.js:1 invoke_iiiiadcap-dev.js:93 rVadcap-dev.js:93 ixadcap-dev.js:61 QIcadcap-dev.js:73 Yydadcap-dev.js:73 Wydadcap-dev.js:73 Yvdadcap-dev.js:73 Swdadcap-dev.js:73 Vwdadcap-dev.js:45 gceadcap-dev.js:9 QNpadcap-dev.js:9 PNpadcap-dev.js:29 RKoadcap-dev.js:29 QNoadcap-dev.js:29 PNoadcap-dev.js:29 qMoadcap-dev.js:29 mMoadcap-dev.js:29 zFoadcap-dev.js:29 aJoadcap-dev.js:29 _Ioadcap-dev.js:29 FJoadcap-dev.js:29 EJoadcap-dev.js:25 AEgadcap-dev.js:25 zEgadcap-dev.js:13 TDhadcap-dev.js:9 $8padcap-dev.js:109 wKtadcap-dev.js:1 invoke_iiiiadcap-dev.js:93 rVadcap-dev.js:93 ixadcap-dev.js:61 QIcadcap-dev.js:73 Yydadcap-dev.js:73 Xwdadcap-dev.js:73 Zwdadcap-dev.js:73 Ewdadcap-dev.js:61 KBcadcap-dev.js:109 UItadcap-dev.js:1 invoke_viiadcap-dev.js:77 Ycdadcap-dev.js:53 jBfadcap-dev.js:109 UJtadcap-dev.js:1 Runtime.dynCalladcap-dev.js:1 (anonymous function)adcap-dev.js:1 Browser.mainLoop.runIteradcap-dev.js:1 Browser_mainLoop_runner
    (index):1 XMLHttpRequest cannot load https://config.uca.cloud.unity3d.com/ff804760-3b57-40f3-800f-3a8a1f25a948.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 403.
     
  2. kentunity

    kentunity

    Unity Technologies

    Joined:
    Sep 16, 2014
    Posts:
    55
    Hi @hyperhippo - could you tell me the version of SDK you are using?
    You can check the version in Assets/Plugins/UnityAnalytics/version file.

    The latest SDK (1.8.1) shouldn't trigger an pre-flight OPTIONS request that was shown above.
    Let me know if this is not the case.
     
  3. hyperhippo

    hyperhippo

    Joined:
    Jan 16, 2014
    Posts:
    37
    I was on 1.5.1, trying 1.8.1 now...
     
  4. hyperhippo

    hyperhippo

    Joined:
    Jan 16, 2014
    Posts:
    37
    yes updating 1.8.1 has removed the call. Thank you for the support :)
     
  5. angeloferro

    angeloferro

    Moderator

    Joined:
    Sep 12, 2014
    Posts:
    105
    Thanks for the update @hyperhippo - glad to know it's working on 1.8.1 now :)