Use stale-while-revalidate and 304 Not modified

Hello, Let’s say I have a resource that is fresh for a very short period, so it must be revalidated frequently: max-age=1, stale-while-revalidate=3600

During the revalidation, I’d like to avoid the origin to generate and send the full response if it has not changed. Is it possible to return a 304 Not Modified response to let Cloudflare know that the stale object can continue to be used?

1 Like

Yes.

2 Likes

Your Origin needs to send valid Last Modified or ETag headers, so that there is something for Cloudflare to validate against.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.