[GIS] My geoserver layer is not updated always correctly. Old features are still displayed in different zoom levels

geoservergeoserver-rest-apigeowebcache

It would be great to get an advice on this topic as its something it troubles me regularly in different projects.

I always find it hard to work efficiently with geoserver and geowebcache when it comes to cached layers etc.

I use a stack of technologies, which are difficult to change (in the current project). I know that my geoserver is quite old (2.5).

I also use geoserver api and gsconfig to create new layers, update the bounding box of a layer etc. I also use a set of POST requests (with python) to add new features on my point/polygon and line layers.

It works but not always. Although I send a seed request to make sure that I update my layer based on the new data:

<seedRequest>
 <name>workspace:layer_name.xml</name>
  <srs>
   <number>4326</number>
  </srs>
  <zoomStart>1</zoomStart>
  <zoomStop>20</zoomStop>
  <format>image/png</format>
  <type>truncate</type>
 <threadCount>2</threadCount>
</seedRequest>

I don't always get to see what it actually exists on the layer and is visible through the layer preview functionality of geoserver. Most of the time if I zoom in/out the features appear (in some random zoom level).

I understand that something goes wrong with the seeding process. Tiles are not seeded correctly/ Old features, which were moved or don't exist keep popping up in different zoom levels.

I also suspect that this might be the browser's cache. Of course I cannot ask from the users to hard reset their browser.

Are there specific strategies to follow here? To bypass the cached file etc?


Settings in geoserver

enter image description here

EDIT

Checking the HTTP headers in developers tool I see that my geowebcache-cache-result equals to MISS. There must be something wrong with the WMS request.

This is my RequestURL:

http://geonode.wfp.org/geoserver/wms?SERVICE=WMS&LAYERS=geonode%3Awld_wfp_ipc_phases&FORMAT=image%2Fpng&TRANSPARENT=TRUE&VERSION=1.1.1&REQUEST=GetMap&STYLES=&TILED=true&SRS=EPSG%3A900913&BBOX=-5009377.085,-10018754.17,0,-5009377.085&WIDTH=256&HEIGHT=256

enter image description here

EDIT II

The above image displays the Response Headers for the request of a specific layer. I see now that in other layers there is no issue the geowebcache-cache-result parameter (it equals to HIT).

enter image description here

But if I understand correctly the issue is that while geowebcache in this case works, sometimes it returns outdated tiles. Does someone can understand something more from the above screenshot?

Best Answer

Do you have HTTP caching headers setup for that layer? If so, the browser won't even ask and use its locally cached file. See http://docs.geoserver.org/stable/en/user/geowebcache/responseheaders.html

Also check inside the layer publishing section for the cache headers:

enter image description here

With the above settings the GWC response will contain:

Date:Mon, 05 Sep 2016 14:26:37 GMT
Expires:Mon, 05 Sep 2016 15:26:38 GMT

which implies the browser won't ask for the same tile until the expiry time is reached

Related Question