[Paid work] setting up my game´s images load from CDN

I´m having a problem with my game as I need some images to be loaded from a CDN and I´m not being able to implement this.

The CDN is working fine, if I create a .html file in the same folder the game is, I can load that images withouth any kind of problem, but into de Phaser game they´re not being loaded, so at least the good thing is that the CDN allows to load them, I just need to know how.

This is exactly the error I have:
localhost/:1 Access to XMLHttpRequest at 'https://cdn.************.png?v=1.0' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

If you can fix this, just let me know how much it would be and I´ll pay you instantly if we have the right price :slight_smile:

You use chrome as browser?You have to use an extenstion with it:
Web server for chrome

I would say also check that your cross origin allowing cdn server also allows http origins as well, but you already said that it works within an html file.

Cross origin requests requests has two sides to be configured properly: Server needs to allow other origins access (with certain desired HTTP Methods specified in Access-Control-Allow-Methods) and client request code needs to tell it is a cross origin request.

Have you made sure that the resource url handled correctly? There s a query string at the end of it as v=1.0. Does cdn handles this properly and send the Access-Control-Allow-Origin header with the request?

That allows you to download the images while developing, but I want them to load like any other resource, I don´t ask for that to the user…

Server is allowing that as the html file loads that picture perfectly, so the problem is not on server´s side.

Also, I just tried without that ?v1.0 part and still having the same issue.

The server has to send Access-Control-Allow-Origin to allow cross-origin loading from Phaser.

Images in HTML can still work without Access-Control-Allow-Origin because the browser doesn’t use CORS for those requests.

Does the CDN have any docs on cross-origin use?

I didn´t know the browsers worked that way… I´ll ask the provider then.

Anyway, something to set up in Phaser?

I´ll let you know in like 12 hours if this works… I hope I can pay you for this :slight_smile:

@samme, so this guy told me the request actually needs some info to load the images properly. Can I DM you to give you this info and see if you can make it work? (paid, of course)