[OpenLayers-Users] WMS layers don't honor max-age cache control

brad yoo mildimp at yahoo.com
Sat Jun 7 10:11:35 PDT 2014


I see that my subject is incorrect for this emailed request. It should read "WMS layer doesn't honor cache control header" or something like that. Any help will be greatly appreciated.


On Saturday, June 7, 2014 11:02 AM, brad yoo <mildimp at yahoo.com> wrote:
 


I have a web application that uses OpenLayers to display a base map and also allows users apply or remove specific WMS layers as desired. Everything is working as expected with the exception of layer caching. My geospatial server responds with a Last-Modified header, but OpenLayers doesn't send any requests to the server after the cached tile expires unless I refresh my page first.  For instance, when I first browse to the page using OpenLayers and select a layer to apply I see the appropriate requests being made and the tiles are returned. If I wait until they should expire and then toggle the visibility of the layer off and on again, no requests are made to the server at all until I refresh the page and reapply the layer. The cache control header Last-Modified seems to be honored as long as I refresh the page. If I refresh the page and reapply the WMS layer before the cached tile should expire, I see the request being made to the server and the
 expected 304 response. 

Ive tried setting the layer function redraw to true, but then every time I make the layer visible a request is made with the _OLSALT parameter and the new request is made to the server. Obviously, this is not the behavior I want. When I toggle visibility on, I always want OpenLayers to make a request to the server with the If-Modified-Since header. Is there a way to achieve this expected behavior? What am I missing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140607/ac9cc134/attachment.html>


More information about the Users mailing list