Http2 Push and Cache Control - Cache Control not being respected unless Cache Everything is on?

http2
cache
#1

I’m still in the investigation phase on this one and will inform as we obtain more results but here is the gist:

Nginx host serving up an index.html with a Link: request for main.js preload.http2/push.
Caching strategy: standard.

main.js (max-age=7200, s-maxage=3600) - cf-cache: hit
the index (max-age=7200, s-maxage=3600) is served from nginx with no hit or miss from cf or any status

If I create a page rule set to “Cache Everything” the index and main then return with:

  1. cache-control: public, max-age=31536000
  2. cf-cache-status: HIT

So 2 fold issues: The main one is that the index isnt cached at all. The second is that when using cache everything the cache-control isnt being respected from the origin. We’re far more interested in the first part.

Our current hypothesis is that the cache-control is of differing times and throwing off the cache when served via a push. Anyone run into anything like this?

#2

How does your ‘Cache Everything’-rule look like? Are you sure it is matching the index?

Did you set any Edge Cache TTL?

#3

Page Rule bleh.organtik.com/* Cache Level Cache Everything

Am relatively positive it is matching the index due to the following headers and also the observed performance.

  1. cache-control: public, max-age=31536000
  2. cf-cache-status: HIT
  3. cf-h2-pushed: </i/logos/logo_named_bv_vert.svg>,</main.js>

No separate edge cache ttl observed after the cache everything.
Prior to the Cache Everything the
index cache-control: (max-age=7200, s-maxage=3600) flows through from the origin but no cache status at all so I suspect cache everything is taking over.

#4

You may never want to keep this much long TTL for the HTML, to resolve this you should set Browser cache to “Respect existing header”. Then purge cache. Once, you will do this you can get response whatever you set from the backend. And, I personally feel it’s better to set Caching direction from backend in this kind of case instead of using long browser TTL or some as prefer Edge cache even!!

#5

Thank you, but I think you’re addressing a problem that cloudflare is introducing not the actual issue.

#6

Okay, please elaborate what is the actual issue and its condition. I will try to answer.