Controlling Browser Caching

Can someone explain how caching actually works for Unity WebGL content (and addressables)?

Here's my issue: when uploading new versions of the project to the server, and then trying to run, the first part of the project loads, but it fails when it tries to load addressable assets. I know that I can do Ctrl+F5 to force a refresh ignoring the caches, but that's just not a viable solution for other people visiting the site.

Ideally what I'd like is to do have a cache on (as the project is rather large), but force the browser to always check if it has the latest content, to prevent any issues when updating. Maybe set an expiration date for content, like a week?

I tried disabling DataCaching in the build settings but uncertain that's the issue (also... I do want caching... just not always). I also checked the caching settings in the addressable bundles. I'm confused how the WebGL build settings relate to those settings, if at all, and as usual the Unity documentation is woefully inadequate.

Apparently there are also different ways to control the caching from html, though it is not entirely clear to me how that works or how to go about doing that, I was a bit confused when I was trying to find some information about it.

I found this in the docs https://docs.unity3d.com/2022.1/Documentation/Manual/webgl-caching.html but it might as well be animals growls, I didn't really grasp what the example does or how to actually use it.

So anyone can explain this stuff like I'm 5?

1 Like

Could you explain the failure more? It would help to know more about the actual issue. Also why you are uncertain whether disabling DataCaching resolves the issue - does it or does it not prevent the loading issue?

The extreme test for this issue would be to implement the loader code you linked with that function always returning no-store to disable caching of addressables.