Using stale-if-error


I’m trying to setup my endpoint to always serve resource even when it’s really stale. I want it to be refreshed every 60 seconds but if error occur the stale version should be served.

I did it like this

cache-control: public, max-age=10, s-maxage=60, stale-if-error=86400, stale-while-revalidate=86400

Unfortunately when I shutdown my application (http request returns 502 status code) then cloudflare is not serving stale response (after 60 seconds CF clears cache and starts serving error page)

What am I doing wrong? I would really appreciate your help. Thank you in advance.


is there anyone who can help me with it?


@GulshanKumar is a cache header expert. Maybe he can take a look if he’s around.

closed #4

This topic was automatically closed after 31 days. New replies are no longer allowed.