I'm trying to wrap an existing web app in an Electron app in order to improve the performance.
I would like to override the cache strategy for certain web service calls as I know it will improve performance based on the way I use the website.
I don't control the web app so I cannot make any changes to that.
I have wrapped the web app in a BrowserView
.
Some of the endpoints that the web app using have have this response header: cache-control: no-cache, no-store, no-transform
.
I would like to cache the result for 1 minute even though the server tell me not to.
So far I have tried to override the response header like this:
session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
let headers = details.responseHeaders
headers["Cache-Control"] = ["max-age=60"]
return callback({responseHeaders: headers})
})
But Electron is ignoring the updated response header entirely.
Any ideas to how I can force another caching strategy than the server suggests?