-1

I am trying to load a 3D model using the Three.js MT: / OBJ loader.

Example here: https://threejs.org/examples/#webgl_loader_obj_mtl

The problem is that the Three.js package needs the files and the code to have the same base path.

So if my model is at 3d.com and my files are at 3d.com/files, everything works great.

The thing is, when I use firebase storage to host my 3d files (that users upload), I get an error because the base path is not the same. Firebase storage files start with https://firebasestorage.googleapis.com/v0/... - So I'm getting the CORS issue.

Does anyone know how to get around this?

LukeVenter
  • 439
  • 6
  • 20

1 Answers1

1

Does anyone know how to get around this?

You have to ensure that the backend service is correctly configured and sets CORS headers in the HTTP response. For firebase, I suggest you study the following thread:

Firebase Storage and Access-Control-Allow-Origin

Note, this problem is unrelated to three.js and a pure hosting issue. You will run into this security error with each form of AJAX request.

Mugen87
  • 28,829
  • 4
  • 27
  • 50