Opened 15 years ago

Closed 15 years ago

#2551 closed enhancement (fixed)

WMS option for Cache-control max-age

Reported by: pramsey Owned by: tomkralidis
Priority: normal Milestone: 5.2 release
Component: WMS Server Version: svn-trunk (development)
Severity: normal Keywords:


The attached patch allows users to set the Cache-control: max-age value returned which each map image to a value in seconds, using "http_max_age" "nnn" in the WEB METADATA object. This should provide some speed advantages for tiled clients like openlayers that always access the same WMS GetMap URLs.

See for a good primer.

Attachments (1)

mapwms-http.patch (715 bytes ) - added by pramsey 15 years ago.

Download all attachments as: .zip

Change History (7)

by pramsey, 15 years ago

Attachment: mapwms-http.patch added

comment:1 by tomkralidis, 15 years ago

Paul: thanks for this.

Before I commit, I want to clarify usage and documentation.

Is this a WMS Server only metadata directive (assuming yes). If yes, then I would like to change:

  if( (http_max_age = msLookupHashTable(&(map->web.metadata), "http_max_age")) )


  if( (http_max_age = msOWSLookupMetadata(&(map->web.metadata), "MO", "http_max_age")) )

Or, if you see this as something which could, over time, be used in more than WMS Server, maybe we should define this as a pure mapfile MAP/WEB/METADATA object, and use:

  if( (http_max_age = msLookupHashTable(&(map->web.metadata), "http_max_age")) ) you originally posted in your patch.


comment:2 by tomkralidis, 15 years ago

Milestone: FUTURE5.2 release

comment:3 by pramsey, 15 years ago

As it stands now, Mapserver is only exercised in a cacheable way via the WMS interface, hence the single insertion in mapwms.c. However, if in the future people begin using the standard CGI interface for pulling tiles, this parameter would also be usable by mapserv.c. Flip a coin, I really don't know the answer. I guess YAGNI says that we should do what makes sense for the present use, and that's to treat it like a WMS parameter.

comment:4 by tomkralidis, 15 years ago


Note that the metadata directive is called "wms_http_max_age" or "ows_http_max_age" (code searches in that order).

Paul: please double check and close this ticket if all looks good.

comment:5 by tomkralidis, 15 years ago

Paul: have you had a chance to verify this?

comment:6 by pramsey, 15 years ago

Resolution: fixed
Status: newclosed

Verified, wms_http_max_age works and returns the right headers.

Note: See TracTickets for help on using tickets.