Quantcast
Channel: Questions in topic: "webgl"
Viewing all articles
Browse latest Browse all 2390

CORS request blocked due to x-unity-version header.

$
0
0
We are in the process of updating our Unity project to use the new **UnityWebRequest** instead of **WWW**. However in the WebGL build we are encountering CORS errors with a number of third-party services. For example: > 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). As the error details, this problem is caused by the 'x-unity-version' header that is automatically added by the UnityWebRequest. According to the **[UnityWebRequest.SetRequestHeader][1]** documentation: > The user-agent and x-unity-version> headers are automatically set by Unity> and may not be set to custom values. As these are third-party services, we are unable to configure the *Access-Control-Allow-Headers* to allow this header. It's critical to our product that we are able to access these third-party services as well as have complete access to the RESTful services that UnityWebRequest provides. Any advice or assistance would be greatly appreciated. [1]: http://docs.unity3d.com/ScriptReference/Experimental.Networking.UnityWebRequest.SetRequestHeader.html

Viewing all articles
Browse latest Browse all 2390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>