Overnight we’ve started to see CORS errors in our webpages that use BJS and it’s BJS hosted content/dependencies. They seem like errors you’d get from a misconfigured web server.
Examples of the errors are:
Access to fetch at 'https://preview.babylonjs.com/glTF2Interface/babylon.glTF2Interface.d.ts' from origin 'https://playground.babylonjs.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value '**'. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Access to fetch at 'https://preview.babylonjs.com/loaders/babylonjs.loaders.d.ts' from origin 'https://playground.babylonjs.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value '**'. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Access to fetch at 'https://preview.babylonjs.com/zstddec.wasm' from origin '<REDACTED>' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value '**'. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Did something change recently that would cause this?
I think this issue would be less of a problem for our own webpages if the KTX2 support and its use of ZSTDDecoder didn’t have a hard-coded reference to this external file, and instead came from within the local BJS package:
export class ZSTDDecoder {
public static WasmModuleURL = "https://preview.babylonjs.com/zstddec.wasm";
Was having widespread corruption of these files before this and was about to start hosting them ourselves anyway. Most recently everybody in Netherlands had an edge cache with a corrupted version which broke all GLTF using draco.
By “main distributables” I mean the npm package available at babylonjs with the command npm install babylonjs
We self host the babylonjs package at a specific version with an entry like this in package.json "babylonjs": "^5.0.0-rc.2",
I expected that distributable to contain all libraries and files required by babylonjs. Now I understand thats not the case and some features need libraries available at the preview CDN, which is fair enough.
I’m asking if it will always be the case that some parts of the babylonjs codebase will require us to download those preview libraries and then set the url to our own domain?
Or is the default loading of some libraries from the preview CDN something that only happens for alpha/beta/rc’s.