[Geoprisma-dev] Caching on client-side, TileCache example

Alexandre Dube adube at mapgears.com
Fri Nov 6 10:18:11 EST 2009


Devs,

  I'd like to discuss an important matter : caching on the client-side 
browser in GeoPrisma, most particularly "TileCache" tiles returned by 
the Proxy.

=== Is it wrong ? ===

  The first thing that comes to my mind is that GeoPrisma is an 
"access-controled" application, so caching tiles on the client side 
could be wrong.  For example :
   User "A" has access to some tiles (from sensitive data)
   He visits his application on a public station and the browser caches 
the tiles
   Then he logs off (leaving the cache there)

   User "B" doesn't have access but he's smart and evil
   He goes directly in the cache folder and "voilà"
   Or the same tile request that are cached won't reach GeoPrisma proxy 
since they are cached and will return "304" response....

  In brief, client-side caching really seems to be wrong in a secured 
environment, but it's quite annoying to be waiting for query responses 
(tiles) you should normally have while browsing your map, like zooming 
in and out and in and out always makes the same requests but without any 
caching it becomes much slower...

=== Caching currently in GeoPrisma ? ===

   Currently, GeoPrisma doesn't cache tiles at all on browser-side.  I 
made some tests to verify that fact with the lastest trunk version of 
TileCache that now has X-SendFile support.  I tested with mod_sendfile 
and it works perfectly.  The first query directly sent to the tilecache 
service returns an "Expires" tag that is read by the browser and used 
for caching :

   === tilecache query on the service directly ===

curl -I 
"http://127.0.0.1:8087/tilecache/tilecache.py?LAYERS=gmap_base&BBOX=860892.7437255,-935783.25,2667113.9905882,870437.99686275&REQUEST=GetMap"

HTTP/1.1 200 OK
Date: Fri, 06 Nov 2009 14:40:18 GMT"200" and the same request made after 
returns "304", see :
Server: Apache/2.2.11 (Unix) PHP/5.2.9 mod_python/3.3.1 Python/2.6.2
Expires: Fri, 06 Nov 2009 15:40:18 GMT
Last-Modified: Fri, 06 Nov 2009 14:27:36 GMT
Content-Length: 11451
ETag: "477b4a52f4600"
Content-Type: image/jpeg


  Using the same TileCache service but going through the GeoPrisma Proxy 
reveals some more tags with "no-cache" added.  Therefore, the Proxy 
prevents caching.

curl -I 
"http://127.0.0.1:8087/geoprisma/demo/proxy.php?osmservice=S_TC_DEV4G&osmtoken=TODO 
Delete 
this&osmresource=R_GMAP_BASE&FORMAT=image%2Fjpg&LAYERS=gmap_base&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A42304&BBOX=860892.7437255,-935783.25,2667113.9905882,870437.99686275&WIDTH=256&HEIGHT=256"

HTTP/1.1 200 OK
Date: Fri, 06 Nov 2009 14:40:16 GMT
Server: Apache/2.2.11 (Unix) PHP/5.2.9 mod_python/3.3.1 Python/2.6.2
X-Powered-By: PHP/5.2.9
Set-Cookie: PHPSESSID=f420f531163be39d51d519f6b61ea6a0; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0
Pragma: no-cache
Connection: close
Content-Type: text/html


=== Do we want caching in GeoPrisma ? ===

  My first though is 'yes', since it comes with a big performance 
improve while using the application.  We should list the potential flaws 
it can creates and find a way to fix them.

  What are your thoughts on that subject ?

-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Geoprisma-dev mailing list