Opened 11 years ago

Closed 11 years ago

#1023 closed enhancement (fixed)

mod_tile should add an ETag cache validation HTTP header

Reported by: Grant Slater Owned by: jburgess@…
Priority: minor Milestone:
Component: mapnik Version:
Keywords: mod_tile etag 304 Cc:

Description

mod_tile does not add any cache validation headers.

Adding an Etag header based on the tile's md5sum, will allow an unmodified tile to be cached over planet imports.

Change History (3)

comment:1 Changed 11 years ago by jburgess@…

Owner: changed from jburgess777@… to jburgess@…
Status: newassigned

This is partially implemented in r8961. The code now adds the default etag header based on 'inode-size-mtime' instead of the md5sum.

comment:2 Changed 11 years ago by jburgess@…

I've implemented an md5 based etag but it does not work as intended. The rendered tiles fail the If-Modified-Since test even though they have the same etag:

  GET /osm_tiles2/15/16343/10858.png HTTP/1.1
  If-Modified-Since: Sat, 12 Jul 2008 23:26:08 GMT
  If-None-Match: "1e6c75d615a3a543308b1036c9bfacb0"
  
  
  HTTP/1.1 200 OK
  Date: Sun, 13 Jul 2008 00:28:06 GMT
  Server: Apache/2.2.8 (Fedora)
  Last-Modified: Sun, 13 Jul 2008 00:28:07 GMT
  ETag: "1e6c75d615a3a543308b1036c9bfacb0"
  Content-Length: 10712

Any ideas on how to fix this? Perhaps dropping the last-modifed header would fix it, but might this break other things?

comment:3 Changed 11 years ago by jburgess@…

Resolution: fixed
Status: assignedclosed

I've moved over to an MD5 based etag in r8969 and dropped the Last-Modified header. This seems to do the right thing with browsers that supply the etag in the If-None-Match request header. Now if only we can teach other download tools to use the etags as well.

The rest of the mod_tile code uses the modified timestamp to know when a render was last attempted. There is no easy way to preserve the modification time of when the tile content really changed.

Note: See TracTickets for help on using tickets.