load model from external url (CORS?)

Dear All!

I would like to add a glb/gltf model to my scene. Everything works fine when the model is on the same server than the app itself. But I wish to store the individual models on a different server. In this case, Cesium is unable to download the models and the corresponding textures.

If I simply insert the url into a new browser window, it is accessible with no problem. I guess this is because of CORS, but I have no idea how I could solve it.

My code looks like this:

var viewer = new Cesium.Viewer('cesiumContainer');

var czml = [


     "id": "document",

     "name": "CZML Model",

     "version": "1.0"



     "id": "varoshaz",

     "name": "2534_1_Varoshaz_ter_9a_E94E_georef3",

     "position": {

         "cartographicDegrees": [20.775372, 48.102767, 0]


     "model": {

         "gltf": "https://myserver/models/collada/varoshaz.glb",

         "scale": 1,

         "minimumPixelSize": 128









I actually provided a solution, but it makes everything quite slow: I built a Java proxy for the glb file; in that case, the model is downloaded, but the textures are again not loaded. I had to modify the model itself, and the texture reference url-s were manually replaced to a proxied url. After that, the models could be downloaded, but so much slower than it was when the models were stored locally.

I would like to avoid proxying everything if it is possible in some ways.

Any help is highly appreciated!


Your other server needs to send the Access-Control-Origin-Allow header. How that is done varies based on the server.

http://enable-cors.org/ is a good resource for learning about CORS and enabling it on different servers.

Thank you for the answers!

Unfortunately modifying the remote server to send the Access-Control-Origin-Allow header was not an option in my case, I don’t have admin rights. Therefore I stayed at the solution of using my Java proxy.

However, I managed to optimize the number of downloads by embedding all the textures as “data:image/jpeg;base64” into the gltf file itself (I used czml-writer for that). Although the file size became bigger, there are no extra downloads, and the scene loading time became much much better as a result.



  1. november 20., péntek 3:43:09 UTC+1 időpontban Matthew Amato a következőt írta: