Jump to content

How does setCORS work


squilibob
 Share

Recommended Posts

I am trying to use an image hosted on a CDN that requires CORS . This works in Phaser 2 by setting

    game.load.crossOrigin = 'anonymous';

but in Phaser 3 I cannot get this to work. I can set crossOrigin by using .setCORS in my scene config or on the image being loaded itself but I must be using it incorrectly because I still get the (CORS header 'Access-Control-Allow-Origin' missing) error.

Link to comment
Share on other sites

On 4/14/2018 at 3:55 AM, squilibob said:

I still get the (CORS header 'Access-Control-Allow-Origin' missing) error.

That actually sounds like the CDN is ignoring or denying the cross-origin request. That seems unusual for a CDN though.

Can you open the image URL directly?

Link to comment
Share on other sites

10 hours ago, samme said:

That actually sounds like the CDN is ignoring or denying the cross-origin request. That seems unusual for a CDN though.

Can you open the image URL directly?

It works fine opening directly. https://cdn.betterttv.net/emote/55b49352120a3d66411fafd6/1x

For now I'm just using a CORS proxy but I was under the assumption that the .setCORS() function would allow me to use it in webgl/canvas. I just don't know what to set it to.

I've tried:

this.load.setCORS('anonymous')
this.load.setCORS('Anonymous')
this.load.setCORS(true)

 

Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...
  • 1 month later...

I'm getting this issue too testing with NestJS/Express, do you know how to solve that? I can't find any log debugging from back

SOLVED (using app.yaml) ?

runtime: nodejs10
network:
session_affinity: true
entrypoint: npm run start:prod
handlers:
  - url: /images
     static_dir: dist/public/images
     http_headers:
       Access-Control-Allow-Origin: '*'
Edited by jdnichollsc
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...