Reputation: 91
I'm currently attempting to load a gltf model into my Aframe scene from Google Drive like this:
<a-entity gltf-model="url(https://drive.google.com/uc?export=view&id={redacted})"></a-entity>
But I'm getting the following error:
Access to XMLHttpRequest at 'https://drive.google.com/uc?export=view&id={redacted}' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I'm using a python SimpleHTTPServer configured to allow CORS from here: https://gist.github.com/mkows/cd2122f427ea722bf41aa169ef762001
When I upload an image to google drive and attempt to load that using
<img src="https://drive.google.com/uc?export=view&id={redacted}" />
the image loads fine.
What could be wrong?
Upvotes: 0
Views: 909
Reputation: 944320
I'm using a python SimpleHTTPServer configured to allow CORS
Not for this.
That request is being serviced by the server responsible for drive.google.com
, not localhost:8000
.
You've applied the CORS headers to the wrong server.
Since you don't control Google Drive's response headers, consider hosting the file elsewhere (or proxying it through you own server, which is effectively the same thing).
Upvotes: 1