You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, GeoServer sends header: Cache-Control: no-cache.
Application is loaded and OpenLayers requests vector tile that is already in GWC cache. Let's assume it has header Last-Modified: Tue, 25 Jun 2024 00:55:00 GMT
Now, I modify geometry (by editing tools, geometry is loaded in custom way from backend API) and press SAVE button. What happens next:
Geometry is sent to custom backend
Backend persists geometry to Postgre database
Backend calls REST API in GeoServer to truncate GWC cache for underlying layer in a given area (BBOX of feature geometry + some buffer)
Related vector tiles are deleted from file system by GeoServer
When all backend tasks are completed, Javascript logic (front-end) calls Layer.refresh() on layer with vector tiles.
OpenLayers starts to send requests to GeoServer with header: If-Modified-Since: Tue, 25 Jun 2024 00:55:00 GMT
GWC does not find related tiles and generates them. But it sends a response with header: Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT
which makes browser to ignore loading fresh tiles. Basically it's a response 304 from GeoServer..
Vector tiles in OpenLayers are not reloaded from GeoServer (while they are generated by GeoServer during this request) and previous tiles from browser cache are extracted..
So, in a result OL renders old tiles from browser cache (because of 304 response).
All these is because for some reason GeoServer sends Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT header for new tiles being generated which is earlier than If-Modified-Since: Tue, 25 Jun 2024 00:55:00 GMT in a request.
And only on second Layer.refresh() browser gets a response 200 with fresh tiles because on second attempt GeoServer sends actual timestamps of files (tiles are saved in file system).
I believe if GeoServer would first save new tiles to store (file system) and sens real timestamps in "Last-Modified" header then OpenLayers would successfully refresh tiles from first call Layer.refresh().
The text was updated successfully, but these errors were encountered:
Interesting behavior.
Let's say, there is an OpenLayers app working with vector tile layer.
geowebcache.xml has this settings:
So, GeoServer sends header: Cache-Control: no-cache.
Application is loaded and OpenLayers requests vector tile that is already in GWC cache. Let's assume it has header Last-Modified: Tue, 25 Jun 2024 00:55:00 GMT
Now, I modify geometry (by editing tools, geometry is loaded in custom way from backend API) and press SAVE button. What happens next:
Geometry is sent to custom backend
Backend persists geometry to Postgre database
Backend calls REST API in GeoServer to truncate GWC cache for underlying layer in a given area (BBOX of feature geometry + some buffer)
Related vector tiles are deleted from file system by GeoServer
When all backend tasks are completed, Javascript logic (front-end) calls Layer.refresh() on layer with vector tiles.
OpenLayers starts to send requests to GeoServer with header: If-Modified-Since: Tue, 25 Jun 2024 00:55:00 GMT
GWC does not find related tiles and generates them. But it sends a response with header: Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT
which makes browser to ignore loading fresh tiles. Basically it's a response 304 from GeoServer..
Vector tiles in OpenLayers are not reloaded from GeoServer (while they are generated by GeoServer during this request) and previous tiles from browser cache are extracted..
So, in a result OL renders old tiles from browser cache (because of 304 response).
All these is because for some reason GeoServer sends Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT header for new tiles being generated which is earlier than If-Modified-Since: Tue, 25 Jun 2024 00:55:00 GMT in a request.
And only on second Layer.refresh() browser gets a response 200 with fresh tiles because on second attempt GeoServer sends actual timestamps of files (tiles are saved in file system).
I believe if GeoServer would first save new tiles to store (file system) and sens real timestamps in "Last-Modified" header then OpenLayers would successfully refresh tiles from first call Layer.refresh().
The text was updated successfully, but these errors were encountered: