Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Networking UnityWebRequest - 'x-unity-version' header blocking CORS requests

Discussion in '5.4 Beta' started by JJJohan, Apr 7, 2016.

  1. JJJohan

    JJJohan

    Joined:
    Mar 18, 2016
    Posts:
    214
    I'm having trouble using UnityWebRequest that's now no longer considered 'Experimental' in Unity 5.4 to perform certain web requests due to extra headers being included within HTTP messages. This issue is only problematic with WebGL because it is invoking CORS request security problems.

    Code (JavaScript):
    1. Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [url]. (Reason: missing token 'x-unity-version' in CORS header 'Access-Control-Allow-Headers' from CORS preflight channel).
    I've done a search and have found two threads, both unanswered. I'm sure it has a purpose or it wouldn't be there, but please make it possible for us to switch this header off for scenarios like this.

    For reference, these are the two threads I've found:
    http://forum.unity3d.com/threads/remove-x-unity-version-from-www-get-post.289704/
    http://answers.unity3d.com/questions/1163449/cors-request-blocked-due-to-x-unity-version-header.html
     
  2. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,073
  3. jasonMcintosh

    jasonMcintosh

    Joined:
    Jul 4, 2012
    Posts:
    74
    @Schubkraft Will these various fixes for 5.4 get backported to 5.3 in patch releases?
     
  4. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,073
    It is planned to get backported to a 5.3 patch release. Can't say which one it will be yet. Earliest might be 5.3.5p2.
     
    jasonMcintosh likes this.