I am using Leaflet to access an authenticated tile server. The tile server needs an Authorization header added to each tile request. Apparently this is not possible in plain leaflet because it is using
<img> tags to request tiles:
I would like to extend TileLayer to add the Authorization header but I'm stuck on a few points.
My client is a Shiny app, not sure if that matters.
It is possible to extend L.TileLayer to use a different method to fetch tiles. Docs here:
Here is an example of extending the WMS layer to use XMLHttpRequest with custom headers to fetch WMS tiles. I would like to do this with XYZ tiles: