• Runtimes
  • CORS error when using spine-player with CDN files

Hi there,

When I try to use spine-player with .atlas and .skel files uploaded to S3, I get this CORS error:

Access to XMLHttpRequest at 'https://somesecretcdn/character.atlas' from origin 'http://localhost:3001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I don't have any issues if i'm using a local file, but I need to use the cdn file.

Thanks

Related Discussions
...

The CORS error you are encountering is due to the server hosting your assets not allowing cross-origin requests. To resolve this, you need to configure your S3 bucket to include the Access-Control-Allow-Origin header in its responses. This can be done by setting up a CORS policy for your S3 bucket. Here is an example of a CORS configuration you can use:

[
  {
    "AllowedHeaders": ["*"],
    "AllowedMethods": ["GET", "HEAD"],
    "AllowedOrigins": ["*"],
    "ExposeHeaders": []
  }
]

This configuration allows any origin to access your assets using GET and HEAD requests. You can adjust the AllowedOrigins to be more restrictive if needed, such as only allowing requests from your specific domain.

just saw this in the docs:
"When using absolute URLs to another domain, it is possible that web browsers won't be able to load the assets. This is usually due to not having CORS enabled on the server that hosts the assets."

resolved