protomaps / PMTiles

Cloud-optimized + compressed single-file tile archives for vector and raster maps
https://protomaps.com/docs/pmtiles/
BSD 3-Clause "New" or "Revised" License
2.07k stars 122 forks source link

Limit client side requests? #471

Closed koufopoulosf closed 1 month ago

koufopoulosf commented 1 month ago

Hello 👋

I would like to ask whether it's possible to apply any kind of rate limiting (or protection) on publicly exposed .pmtiles via maplibre:

https://github.com/protomaps/PMTiles/blob/main/js/examples/maplibre.html

Adding a server between client and the S3-compatible bucket, e.g. serving the tiles using Martin (https://github.com/maplibre/martin) would be an option, but serving them directly from S3 would result in a more maintenance free solution. Would it be possible to restrict certain users from hammering with GET requests the .pmtiles file? Any ideas would be highly appreciated!

Thanks in advance!

koufopoulosf commented 1 month ago

What could also probably prevent hammering is caching. Is tile caching supported on maplibre url pointing to the remote (s3-compatible bucket) .pmtiles file, or should we serve tiles in ZXY format using a tile server like Martin?