Server-side change to disable Firefox Race Cache with Network (RCWN)?

Viewed 218

I know that it's possible to disable RCWN in my copy of Firefox, but I'm trying to find if there is a way for the server-side to tell all Firefoxes in the world not to use RCWN against particular resources?

Our app uses cloud file storage and we get charged for network traffic. We've configured the server to send appropriate caching headers so that browsers will only download the images (potentially very large) one time and then load them from cache so that we don't get charged over and over again when someone reloads a particular page on our website.

This works very well in Chrome, but Firefox has a feature called Race Cache With Network. RCWN allows Firefox to try loading from cache but simultaneously load from the network and then which ever one finishes first is the winner. But that means that every user with FF is going to be constantly re-downloading these large images even though they are cached which means we're having to pay for the network traffic even though they've got a perfectly good cache of the image.

I would assume the cache could load a 22MB png file faster than the network does, but the FF inspector says it is still taking like 8 seconds to load during the race and the network download won. And even if the network download loses to the cache, it was still downloading most or all of the image anyway.

Are there any http response headers we can add to tell FF not to use RCWN with certain resources?

Here is an example of the headers we send back now:

Content-Type: image/png 
Expires: Sat, 06 Jul 2030 21:06:51 GMT 
Last-Modified: Tue, 07 Jul 2020 05:21:42 GMT 
Pragma: cache 
Cache-Control: max-age=315360000, private 
Content-Disposition: inline; filename="bob-woodward-book-trade-deficits-lodestar.png" 
1 Answers

Ideally, a Firefox dev will swing by and provide us all with a truly definitive answer to this. Meanwhile though, having dug around a bit and waded through some of the source code, I'm pretty certain that the answer is "no". (Not very surprising, I guess, but perhaps a wee bit disappointing.)

Aside from the source code, useful nuggets can be found all over the place, including these slides from 2017 which explain the motivation for creating RCWN: https://slides.com/valentingosu/race-cache-with-network-2017

(PS: my own motivation for digging into this is connected to my own question from a few days ago. My tentative conclusion from everything I've seen so far is that the caching system within Firefox has some fairly fundamental performance issues. It may of course be awfully hard to do a better job than the current code does!)

Related