mod_tile icon indicating copy to clipboard operation
mod_tile copied to clipboard

Difficulty to expose metatile as a HTTP response header?

Open Firefishy opened this issue 2 years ago • 5 comments

I am looking at improving caching and purging for tile.openstreetmap.org see: https://github.com/openstreetmap/operations/issues/947

How much effort would it be to expose the source metatile in a HTTP response header? eg:

Surrogate-Key: meta_z_x_y 

The format of z_x_y isn't important. Any logical format is ok.

Would there be a performance impact?

Firefishy avatar Sep 01 '23 20:09 Firefishy

Hello @Firefishy, it's not very difficult, here's a very basic example of what could be done to satisfy your request: https://github.com/openstreetmap/mod_tile/compare/master...hummeltech:mod_tile:MetaTileFileNameInHTTPHeader

There is certainly a lot of room for improvement, I.E. it might also be nice to have it be optional via a configuration entry.

hummeltech avatar Sep 06 '23 02:09 hummeltech

That looks very good, but the header specifically needs to be named Surrogate-Key:

Firefishy avatar Sep 12 '23 13:09 Firefishy

Alright, I understand this a bit better, I updated the code, try it out now.

hummeltech avatar Sep 13 '23 16:09 hummeltech

Looks Great!

Firefishy avatar Sep 29 '23 19:09 Firefishy

Hello @Firefishy, Let me know if this has been found to be useful in any deployments, and if so, whether or not we should open up a pull request (including customizability via httpd.conf option(s)) to get this functionality supported in a release.

hummeltech avatar Dec 01 '23 16:12 hummeltech