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.24k stars 640 forks source link

Response headers for cache #319

Open Rajavelu opened 6 years ago

Rajavelu commented 6 years ago

Refer attached images: pbf files cached in disk, but json files not cached. Need to add headers for cache, right? How to do?

screen shot 2018-10-08 at 1 04 17 pm screen shot 2018-10-08 at 1 04 41 pm
beeing commented 1 month ago

Hi, I think this has been awhile, but if to enhance this without setting up a cache proxy, we can set the response header with "Cache-Control": "public, max-age=86400"

The value is in seconds, which 86400 is 24 hours

Refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#response_directives

Note that this is cache directive for client side, which if there's many clients connected to the server, it will still slow down the server due to duplicate requests.