Reputation: 604
Specifically the cache-control property:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="no-cache" />
</customHeaders>
</httpProtocol>
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json; charset=utf-8"/>
</staticContent>
</system.webServer>
</configuration>
I'm developing locally with a Node server and everything works fine, but on our deployment server the app runs in an IIS instance and the ServiceWorker isn't caching the requested assets. It's not throwing errors either, so I'm wondering if it's just this "no-cache" declaration getting in the way.
I'm super new to ServiceWorkers and not at all a devops guy. Not hunting for the exact solution, just trying to narrow down the diagnosis so I have a clearer idea what to ask my back-end developer.
Thank you!
Upvotes: 2
Views: 1272
Reputation: 3893
IIS Cache settings have no affect on service worker caching. Remember the server code and the client code are completely decoupled. What you are setting in IIS is the Cache-Control header value. This value is used by the browser cache, not service worker cache. You are 100% in control of what gets cached and how long it is cached in the service worker cache.
Upvotes: 3