Custom terrain: Request Header (with Bearer auth) only use for the top json file

Hi all,

We are working on an Unreal application based on the Cesium for Unreal plugin to access a custom terrain (QTZ).

Each request to the terrain server must include an authentication token in the request header. We define this token in the tileset properties in Unreal.

When loading, the first file —
https://ourserver/terrain/layer.json
— is retrieved successfully, and the server logs confirm that the token is present in the request.

However, once the terrain loader begins fetching tiles (for example:
https://ourserver/terrain/2/1/3.terrain?v=1.1.0
), all of these requests fail with a 401 Unauthorized error. On the server side, we can see that these sub-requests do not include the authentication token in the header.

It looks like the defined header is not being propagated to subsequent tile requests. Interestingly, when accessing 3D Tiles, the same mechanism works fine — the header defined for tileset.json is also used for GLB and texture requests.

Has anyone encountered this same issue, or conversely, successfully accessed a custom terrain protected by a token?

Any hints would be greatly appreciated.

Hi @ftrastour,

I can confirm this is a bug in Cesium for Unreal. I wrote an issue for it here:

Hi Kevin,

I suspected this was a bug in Cesium-Native rather than only in Cesium for Unreal—thanks for confirming.

A colleague of mine already posted an issue in the Cesium for Unreal repo here: Cesium3DTileset doesn't propagate Request Headers for quantized terrains · Issue #1722 · CesiumGS/cesium-unreal · GitHub. Do you think we should mark that one as a duplicate of your issue and close it?

Also, do you expect this to be fixed in the next release, or would you recommend that we try to investigate and submit a PR ourselves (though we have limited knowledge of Cesium-Native internals)?

Thanks,
Fred

Hi @ftrastour,

We’ll try to get this fixed as soon as we can, but I can’t commit to a particular release. If your team has the bandwidth to take a look at submit a PR, that would be amazing!