Cross-origin image at may not be loaded with PlayCanvas and Amazon s3

859 Views Asked by At

I'm trying to load texture with PlayCanvas webGL library from an Amazon S3 bucket but an error happens after loading:

Uncaught DOMException: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at --- may not be loaded.

launched by playcanvas-stable.js at line

gl.texImage2D(gl.TEXTURE_2D, mipLevel, texture._glInternalFormat, texture._glFormat, texture._glPixelType, mipObject);

I made a redirect from 'example.example.com' to 'resources.example.com'. The redirect URL (resources.example.com) is the address of Amazon S3 bucket where texture are stored.

I see many similar errors, so I set the Amazon S3 bucket CORS in this way:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>

But nothing changes...

Is there something I can fix?

Have you found similar issues?

Thanks.

0

There are 0 best solutions below