Closed joshuabaker closed 3 years ago
Reading Cloudflare’s article on this rule, there’s actually mention of the Expires
header.
Cache-Control headers sending "private","no-cache", or "max-age=0" or Expires header with a date in the past will override the rule and cause Cloudflare to NOT cache the resource. To override these you'd need to add another setting called "Edge Cache TTL" and set it to however long you'd like Cloudflare to cache that resource on our servers.
It looks like setting the Expires
header manually gets a cf-cache-status: HIT
.
Yep. The Expires
header looks to be culprit here.
Not sure how best to approach this from the plugin perspective. Should Upper set this in EventRegistrar.php
? Considering that Expires
is ignored by everyone conforming to the RFC it shouldn’t be an issue, right?
@joshuabaker Nah, Cache-Control
works perfectly.
Can you provide an example? Via private channel, if you like ...
HTTP/1.1 200 OK
CF-Cache-Status: HIT
CF-RAY: 4ad38f25b9d56373-FRA
Cache-Control: public, s-maxage=604800
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=UTF-8
Date: Fri, 22 Feb 2019 18:36:36 GMT
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
Set-Cookie: __cfduid=d1cedc6726af4441238cfc03d79d2ada51550860596; expires=Sat, 22-Feb-20 18:36:36 GMT; path=/; domain=.env.name; HttpOnly
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Upper-Cache: CACHED: 2019-02-22T18:35:01+0000
@joshuabaker Doublecheck your "Cache Level" Page Rule https://github.com/ostark/upper/tree/develop#cloudflare
ME: requires further research
I’m trying to get Upper (1.4.2) working with Cloudflare.
Despite seeing
cache-control: public, s-maxage=604800
andx-upper-cache
headers I’m also gettingcf-cache-status: MISS
.If I add ‘Edge Cache TTL’ in the Page Rule, alongside ‘Cache Level: Cache Everything’, pages start to cache on the CDN, however, it also means that
cache-control: private, no-cache
is ignored, which messes up the control panel and other dynamic pages.What might I be missing here?