ipyleaflet icon indicating copy to clipboard operation
ipyleaflet copied to clipboard

Adding request headers for VectorTileLayer?

Open deeplook opened this issue 4 years ago • 5 comments

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?

deeplook avatar Mar 11 '21 14:03 deeplook

Alternatively, something specific for the Authorization header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization).

stefano-xy avatar Mar 16 '21 12:03 stefano-xy

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?

deeplook avatar Mar 16 '21 12:03 deeplook

@davidbrochart @martinRenou Any idea?

deeplook avatar Mar 23 '21 11:03 deeplook

Indeed, it would be a matter of exposing the possibility to configure the fetchOptions parameter of Leaflet.

stefano-xy avatar Apr 28 '21 17:04 stefano-xy

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

bkanuka avatar Jun 14 '21 20:06 bkanuka