question

david.a.diaz@gmail.com avatar image
david.a.diaz@gmail.com asked

Unity WebGL Content Download Not Working

Hello,

I'm making a multiplatform game in Unity and have most of the assets in the CDN so that the web client is fairly small and the ios and android clients can be downloaded through the cellular network. IOS is downloading the content from the CDN just fine but the WebGL client is showing this error in the browser's console:

07:43:57.245 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://pf-content-live.s3-us-west-2.amazonaws.com/4743/etc/Config.txt?AWSAccessKeyId=ASIAJULPDLD7KHIR3S4Q&Expires=1463147034&x-amz-security-token={ {security token}}&Signature={ {signature}}. (Reason: CORS header 'Access-Control-Allow-Origin' missing).1 <unknown>

It seems that the PlayFab API correctly returned the CDN URL of the asset but there's an error in the CORS configuration on the server. I checked this link:

http://docs.unity3d.com/Manual/webgl-networking.html

But I can't modify the .http access file on the server. Is there something you guys can do?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

While the security token and signature do expire, I'd still recommend not posting them in questions, so I've edited them out of your post, FYI.

The current CDN configuration is set up to allow for download to any external endpoint, using the signed URL - otherwise, the Content service wouldn't work for anyone outside the same domain. Can you send us the specific details of how you're attempting to access the content URL?

 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

david.a.diaz@gmail.com avatar image
david.a.diaz@gmail.com answered

I built the game using the webgl exporter of unity and double cliecked the index.html, but just to test I started a web server @ the build folder and opened the game through localhost:8081 and it worked, the assets were downloaded correctly from the server.

Many thanks!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Excellent - glad to hear you're un-blocked!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.