maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.12k stars 613 forks source link

Add cache bust feature #1202

Open am2222 opened 4 months ago

am2222 commented 4 months ago

Hi,

I was wondering if there is any chance we can add cache bust feature to the tilejson. technically once we renew tiles in the server browsers still use the locally cached data. one workaround is to add a has of last-modified from tile metadata as a query parameter to the tilejson.tiles and it will make browser to invalidate their cache.

I need to read the source code more but I think we can add it here. https://github.com/maptiler/tileserver-gl/blob/500a81e8b32aa83247ff3146a854eecf7059e491/src/serve_data.js#L210C5-L212C7

I can make a PR for this if that makes sense from your perspective!