ipyleaflet
ipyleaflet copied to clipboard
Adding request headers for VectorTileLayer?
VectorTileLayer would benefit from a headers parameter to be passed to the HTTP requests made in order to pass some kind of tokens for example. I'm happy to work on this if somebody can help point me the right way. Maybe a plugin like https://github.com/ticinum-aerospace/leaflet-wms-header would be needed?
Alternatively, something specific for the Authorization header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization).
It looks like Leaflet does in fact support passing headers, see https://github.com/Leaflet/Leaflet.VectorGrid/issues/89. If so it should be possible to suport from ipyleaflet, rather easily, too, right?
@davidbrochart @martinRenou Any idea?
Indeed, it would be a matter of exposing the possibility to configure the fetchOptions parameter of Leaflet.
There's a bit of discussion about incorporating this with leaflet here: https://github.com/Leaflet/Leaflet/issues/2091
Also a leaflet plugin (near the bottom of that thread) that can add headers: https://github.com/jaq316/leaflet-header
Hopefully this can make it easier to integrate into ipyleaflet