Browser Cache TTL / Cache-Control Issue

Hi there,

I’m having an issue setting up Browser Cache TTL properly.

GOAL:

  • set Cache-control for HTML/… = 1 day
  • set Cache-control for JPG/… = 1year
  • take advantage of CF Cache Level: Cache Everything
  • using CF Free Plan, sorry ;(

CURRENT SETTINGS:
Origin Server has the following settings:

ExpiresByType text/html “access plus 1 day”
ExpiresByType image/jpg “access plus 1 year”

TEST #1
CloudFlare PAUSED
Cache-control Results are correct: html =1 day, jpg=1 year

TEST #2
CloudFlare settings are:

  • Browser Cache TTL: Respect Existing Headers
  • Page Rule: example.com/ Cache Level: Cache Everything, Edge Cache TTL: a month, Origin Cache Control: Off

Based on CF explanation: “Unless specifically set in a page rule, Cloudflare does not override or insert Cache-Control headers if you set Browser Cache TTL to Respect Existing Headers” - so i should expect the following result: html=1day, jpg=1year.

In reality cache-control values are incorrect: html=1day, jpg=NONE

TEST #3
CloudFlare settings are:

  • Browser Cache TTL: 1year
  • Page Rule: example.com/ Cache Level: Cache Everything, Edge Cache TTL: a month, Origin Cache Control: Off

Cache-control Results are incorrect: html =1year, jpg=1year

TEST #4
CloudFlare settings are:

  • Browser Cache TTL: Respect Existing Headers
  • Page Rule: example.com/ Browser Cache TTL: 6 months, Cache Level: Cache Everything, Edge Cache TTL: a month, Origin Cache Control: Off

Cache-control Results are incorrect: html =6 months, jpg=6 months

ANALYSIS
Test #1 : result is perfect but we cannot pause CloudFlare

Test #2 : logically the best settings but result is incorrect

Test #3 : result is incorrect

Test #4 : result is incorrect

QUESTION
Why Test #2 results are not matching CloudFlare’s expectations?

Thanks a lot!

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