The.STL model cannot be displayed after being obtained from the cloud server

I requested that the babylonjs sample.stL file display properly in the browser. When I put the.stl file on my own cloud server and sent the request, the task content was not displayed on the page, and the browser console reported an error.

I find that the response headers are the same, and the response also returns the content. Why does the error occur?

my code:

The same code works fine when I request https://models.babylonjs.com/Channel9/Channel9.stl

BABYLON.SceneLoader.ImportMeshAsync(
    '',
    'http://localhost:8906/api/bamboo/api-common/upload/download-file?obsPath=obs://dev/test/',
    'Channel9.stl',
    scene.current,
    (sceneArg) => {
        setLoading(false);
        debugger
        const boundingInfo = sceneArg[0].getBoundingInfo();
        console.log('boundingInfo====', boundingInfo);
        const ratio = 9.0 / boundingInfo.boundingSphere.radius;

        sceneArg[0].position.y = (0 - boundingInfo.minimum.y) * ratio;
        sceneArg[0].scaling.x = ratio;
        sceneArg[0].scaling.y = ratio;
        sceneArg[0].scaling.z = ratio;
        // camera.setTarget(sceneArg[1]);
    }
);

Are you sure the “content-disposition” header is the same in both cases?

What if you request directly the .stl file without passing by the intermediate download-file page?

1 Like

Can you share a repro ?


content-disposition is not the same. This interface is written uniformly, and the back-end programmer may not help me modify it.
I finally gave up using babylon and used three.js to load .stl files.

Sorry, it involves security issues, which I can’t provide at the moment