[OSM-dev] Caching tiles and expiry header

Moataz Elmasry zaza1851983ml at googlemail.com
Mon Jul 5 16:27:03 BST 2010


Hello List

I use http://tile.openstreetmap.org/${z}/${x}/${y}.png to display the 
map in my web application
I use a filter mechanism in the servlet, where an expiry header and 
maximum age headers are added to the image requests, so that they will 
be cached for a while on the client browser. These are just for common 
images that the application use like tooltip.png and button.png and 
such...These are called from the cache just fine

Now to do the same for osm tiles I added a proxy through which the tiles 
are requested and then expiry headers are added to these tiles, Say 
http://myapplciation.com/proxy?url=http://tile.openstreetmap.org/${z}/${x}/${y}.png. 
This is the layer address in OpenLayers.Layer.OSM

An expiry header is added correctly to osm tiles. The problem is that 
the imagename in the request is different than in the response, so if 
I'm requesting |http://tile.openstreetmap.org/16/34687/21558.png I get 
an image called 2736BB16d01.png in my cache. So that by the next call 
this image won't be fetched from the cache and instead called again from 
the server and so on.

Is there a way to force the browser to load the images from its cache if 
available?

Thnx in advance
Moataz
|




More information about the dev mailing list