protomaps-leaflet icon indicating copy to clipboard operation
protomaps-leaflet copied to clipboard

How to insert headers into tilecache fetch request

Open drzhouq opened this issue 2 years ago • 1 comments

@bdon I like the idea of pmtiles a lot. However, it seems that there is no easy way to incorporate some security check (via request header token) https://github.com/protomaps/protomaps-leaflet/blob/754458357228c5a82e85930812cd461d0e9f7d59/src/tilecache.ts#L195

How would you incorporate the fetch request to pass on additional headers?

Thanks, Brandon, for your fantastic job on PMTiles.

drzhouq avatar Oct 16 '23 18:10 drzhouq

if you are using pmtiles you can pass a custom FetchSource with your own headers:

https://github.com/protomaps/PMTiles/blob/main/js/index.ts#L287

bdon avatar Oct 16 '23 22:10 bdon