Does a deploy invalidate the cache created by a proxy rewrite?

Hello!

We use a catch-all redirect to our backend to display pages which were not yet deployed to Netlify

/*  https://backend.example.com/preview/:splat  200

The backend responds with a page which has the following header:

cache-control: max-age=600, public

Netlify caches the result of this rewrite.

But then we have a little cache invalidation issue. For example

Five minutes later a build and a Netlify deploy happen. The /new-page/index.html is deployed to Netlify.

My expectation: Netlify replaces https://frontend.example.com/new-page contents with the newly deployed page.
What happens actually: Netlify still serves the cached version.

Is this behavior expected? I can’t find anything in the docs.

Netlify respects the cache-control header and thus, we avoid setting that:

This is why we always set a max-age of 0 for assets served by Netlify, so that we’re able to handle the cache ourselves.