Reputation: 121
I'm trying to reload the WMTS layer after changing some tiles on the remote WMTS server.
The problem is that I am not able to reload tiles in the current viewport (or in the current zoom level). Other lower resolution tiles are getting reloaded correctly. The issue is that tiles in the viewport redraw but a request to verify ETag is not made. A suspicious thing is that if I disable cache in browser's network tab tiles in the viewport are getting requested correctly.
I am using following snippet for cache invalidation, I do have more layers of different type:
const source = layer.getSource(); // WMTS layer, returns WMTS source
if (source != null) {
source.getTileCacheForProjection?.(this.map.getView().getProjection())?.clear();
source.clear();
source.tileCache.clear();
source.refresh?.();
source.changed();
}
layer.changed();
I tried the snippet in OL v6.3.1 where it worked correctly but not in 6.4.3, 6.14.1 (I use in master branch), or 6.15.1.
My WMTS server does use ETag. Here is two examples of the response header with ETag set
HTTP/1.1 200 OK
Server: Microsoft-HTTPAPI/2.0
Access-Control-Allow-Origin: *
Cache-Control: private, max-age=0, must-revalidate
Content-Disposition: inline; filename=ows-data.png
Content-Length: 64795
Content-Type: image/png
ETag: a22c283e43ab4143
X-Frame-Options: SAMEORIGIN
Date: Thu, 04 Aug 2022 14:20:00 GMT
HTTP/1.1 304 Not Modified
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 04 Aug 2022 14:33:56 GMT
Server correctly returns 304 for lower resolution tiles and 200 with payload for those that changed.
I am kindly asking you to check my trying if I am doing something wrong, please.
Upvotes: 1
Views: 131