Caching headers not respected in CloudFlare

I am trying to get some html pages for caching, just like images are automatically cached via CloudFlare, but I can not get CloudFlare to actually delete its html cache.

According to the documentation (Ref: https://support.cloudflare.com/hc/en-us/articles/202775670-How-Do-I-Tell-CloudFlare-What-to-Cache- ), you can cache everything using the Cache kit -Control on publicwith a max-agegreater than 0.

I tried various combinations of headers on my Nginx source server without success. From the simple Cache-Control: public, max-age=31536000to the more complex titles, including s-maxage=31536000, Pragma: public, ETag: "569ff137-6", Expires: Thu, 31 Dec 2037 23:55:55 GMTwithout any results.

Any ideas on getting CloudFlare to serve html pages from their cache?

PS: I get CF-Cache-Status: HITon images and it works fine, but on html pages nothing, even CF-Cache-Status: something. With the CloudFlare page rule for html pages, it seems to work fine, but I want to avoid using it, mainly because it is too specific for CloudFlare. I do not serve cookies or anything dynamic from these pages.

+4
source share
3 answers

Now it is possible that Cloudflare will respect your web server headers, rather than redefining them with the minimum described in your browser TTL settings.

First go to the Caching tab in the Cloudflare dashboard:

Cloudflare Panel Caching Tab

" ", "Respect Existing Headers" :

Respect existing Cloudflare headers

:

. , Cloudflare 4 Cache-Control. , Cloudflare Cache-Control ( ).

+5

.

Pro . , , . , , "Cache Everything".

, , , CloudFlare . ,

https://blog.cloudflare.com/edge-cache-expire-ttl-easiest-way-to-override/

, , , . . Respect Origin Header . , , .

, - html-. . , , , , . , . , Cache-Control: max-age: 30, . , , , , .

+2

CF . " " , , , .

0

Source: https://habr.com/ru/post/1625212/


All Articles