In my app, Users profiles are open to the public and only updated by the profile owner.
The profile URL is example.com/profile?user=@user.me
And based on the docs https://firebase.google.com/docs/hosting/functions. I can cache the response JSON of the function, in this case, the public profile. Which will save me a lot of at cloud functions executions and Firebase database bandwidth
And when the user updates his profile, I want to re cache the profile in the CDN.
I think that can be done by making the user re-request his public profile, with Cache-Control: no-cache
in the request header, after a successful update of his profile.
And when a user visits that same profile afterward he shall see the new version.
Is that possible ?? or that's not how Cache-Control
shall be used.
firebaser here
The integration between Cloud Functions, Firebase Hosting and its CDN is currently a purely time-to-live based cache. When you set a cache-header in your Cloud Functions, the CDN puts your response in its edge caches for the time period you indicate. Once it expires, the CDN edges will stop serving the content from the cache and request a fresh copy from the server when a user on that edge requests it.
We know that having an API to tell the CDN to refresh this content would allow for many additional use-cases. But this is currently not in the scope of Firebase Hosting.