Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Cloudflare support stale-while-revalidate?

Cloudflare documents a list of directives for the Cache-Control header, including stale-while-revalidate.

  • stale-while-revalidate=<seconds>
    When present in an HTTP response, the stale-while-revalidate Cache-Control extension indicates that caches MAY serve the response in which it appears after it becomes stale, up to the indicated number of seconds since the object was originally retrieved.

I set my Cache-Control header to public, max-age=0, stale-while-revalidate=30 but I never seem to get a cache hit. Does Cloudflare actually support this?

like image 665
Dan Fabulich Avatar asked Jan 06 '18 04:01

Dan Fabulich


1 Answers

If you put max-age=0, then effectively nothing is cached, if so, then there is nothing to serve. Try with max-age=1 - that should give some results in that 30 sec. period.

like image 138
Michał Zaborowski Avatar answered Nov 13 '22 11:11

Michał Zaborowski