I want to use the load method to load a .glb file from my server. When I try, I get cors errors. The cors configuration on my server has been done. I’ve looked for ways to pass the Access-Control-Allow-Origin header from the file load, but it still doesn’t work.
I look forward to your help in solving this problem.
This must be set by the server. There’s nothing three.js or glTF-specific to do, I think you could ‘test’ the workflow just with some code like:
const glb = await fetch('https://example.com/api/my-model.glb')
.then((res) => res.arrayBuffer())
If that snippet of code also doesn’t work with your Laravel server, you may have better luck asking in a Laravel-related forum or Stack Overflow… I don’t know the details of setting HTTP headers in Laravel, or what other errors you might be seeing.
You may also want to set the Content-Type header to something like application/octet-stream
for GLB.