I am experiencing a bizarre WKWebView
behaviour and I am working out of concepts.
- Typically, for instance 1 in 50 masses, the WebView wouldn’t carry out a recent request however load a cached one as an alternative.
let request = URLRequest(url: url)
wkWebView.load(request)
- Server response headers point out that the cache must be legitimate for 45 seconds. It appears like the online view doesn’t at all times respect this.
:standing 200
xkey ***
x-main-entity-urn ***
x-main-entity-title ***
differ Settle for-Encoding
content-encoding gzip
content-length 43063
content-type textual content/html; charset=UTF-8
x-host ***
x-frame-options SAMEORIGIN
accept-ranges bytes
date Thu, 20 Jul 2023 09:57:50 GMT
access-control-allow-origin *
x-content-type-options nosniff
referrer-policy no-referrer-when-downgrade
strict-transport-security max-age=2592000; includeSubDomains; preload
x-xss-protection 1; mode=block
expires 0
cache-control public, max-age=45, s-maxage=2592000
cache-control no-cache
URLRequest
makes use of default configuration
What appears to be a repair is clearing the cache utilizing:
WKWebsiteDataStore.default().removeData(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes(),
for: data,
completionHandler: {
})
Nonetheless, that is an overkill because it additionally clears different issues that must be cached longer (e.g. pictures).
What am I lacking right here? What could possibly be the explanation that the online view doesn’t run the request however masses it from the cache inspite of being instructed to not use the cache?