Forum GameFS Unable to Load on Browser "Access-Control-Allow-Origin"

Discussion and help relating to the PlayerIO game asset hosting and CDN solution, GameFS.

Unable to Load on Browser "Access-Control-Allow-Origin"

Postby Zenithin » August 23rd, 2017, 9:43 pm

Hi,

When I tried with GameFS while it worked fine in Unity editor after exporting the webgl build it is unable to fetch the file from gamefs.

This is the error in the console of browser
XMLHttpRequest cannot load http://playerio-a.akamaihd.net/h******* ... /music.ogg. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://********.online' is therefore not allowed access.

Can some one please help to solve it.. I searched online it says server is not sending the correct headers.
Is there something I need to change to make it work?

This says a server Fix needed: https://docs.unity3d.com/Manual/webgl-networking.html
Zenithin
 
Posts: 8
Joined: August 17th, 2017, 10:52 am

Re: Unable to Load on Browser "Access-Control-Allow-Origin"

Postby Henrik » August 24th, 2017, 10:01 pm

You're getting a CORS violation because you're trying to load a music file with XMLHttpRequest, and that is normally used for scripting purposes, not asset loading.

Just load the music file normally or use an asset loader or something instead.
Henrik
.IO
 
Posts: 1831
Joined: January 4th, 2010, 1:53 pm

Re: Unable to Load on Browser "Access-Control-Allow-Origin"

Postby Zenithin » August 24th, 2017, 11:29 pm

Henrik wrote:You're getting a CORS violation because you're trying to load a music file with XMLHttpRequest, and that is normally used for scripting purposes, not asset loading.

Just load the music file normally or use an asset loader or something instead.


I was just using normal Unity WWW method to load audio files. And it did work when I instead placed audio file at another CDN.
Can you maybe point me to how to do so in unity specifically?
Zenithin
 
Posts: 8
Joined: August 17th, 2017, 10:52 am

Re: Unable to Load on Browser "Access-Control-Allow-Origin"

Postby Henrik » August 25th, 2017, 8:14 am

We've fixed this for your game now, so your GameFS assets should be sent with CORS headers when demanded from the CDN.

You might need to re-upload your files to bust all the caches though.

Let us know if you have any further issues with this.
Henrik
.IO
 
Posts: 1831
Joined: January 4th, 2010, 1:53 pm

Re: Unable to Load on Browser "Access-Control-Allow-Origin"

Postby Zenithin » August 25th, 2017, 9:13 am

Henrik wrote:We've fixed this for your game now, so your GameFS assets should be sent with CORS headers when demanded from the CDN.

You might need to re-upload your files to bust all the caches though.

Let us know if you have any further issues with this.


Wow thanks a lot ! I will check if it works. Can you please confirm that this will also resolve the iframig issue I have mentioned in other thread and pm'ed you about.
Zenithin
 
Posts: 8
Joined: August 17th, 2017, 10:52 am

Re: Unable to Load on Browser "Access-Control-Allow-Origin"

Postby poloisyo » April 8th, 2019, 10:26 am

I had the same problem. Thank you so much txxx.mobi/. It works for me now. :D
poloisyo
 
Posts: 2
Joined: April 8th, 2019, 10:20 am


Return to GameFS



cron