All Collections
All Things Caching
How does Progressier deals with opaque responses?
How does Progressier deals with opaque responses?

Find out how Progressier takes care of failed opaque responses automatically

Kevin Basset avatar
Written by Kevin Basset
Updated over a week ago

To learn more about opaque responses in general and what the problem with them is, check out this article. To learn more about our approach at Progressier, please read on.

Opaque responses & caching strategies

Progressier cache opaque responses if you used any strategy other than Network Only. With the Network First strategy, there aren't really any issues. The network has a first go at the resource. If there is a network error, then we use a cached response (if there is one).

Cache First and Stale-While-Revalidate are risky. You could end up using an error response with a 0 status code when a perfectly successful response is available from the network. This is dangerous and very likely to unnecessarily break your app (temporarily with Stale-While-Revalidate, potentially permanently with Cache First).

The Progressier solution

We've chosen to NOT allow you to apply the latter two strategies to resources with opaque responses. Even if you do apply Cache First or Stale-While-Revalidate to resources, Progressier will still use Network First regardless (this only applies to resources that return opaque responses).

A cached opaque response will only be used when the network can't successfully respond to the request. This is the best compromise to protect your app from potentially-fatal caching mistakes and still allow it to work offline.

Did this answer your question?