Page rules bug: Browser Cache TTL sends 10 years instead of 30 minutes

cache
#1

Hello All!

We are now testing if we can use Cloudflare for our new project, DuzyTV and I think we see page rules bug.

Browser Cache TTL sends users 10 years instead of 30 minutes.

What we need: cache static html files for a while on Cloudflare side (cdn.duzyiod.com domain): we set TTL to 10 years, but clear the cache on Cloudflare side using API when we need to update something. But we need to have 0-30 minutes TTL to send to our users’ browsers.

Example: https://cdn.duzyiod.com/3jxTQRIDpvw.html

We have defined page rule:
cdn.duzyiod.com/*.html
Browser Cache TTL: 30 minutes, Cache Level: Cache Everything

We also tried to add “Edge Cache TTL: a month” with same result: Cloudflare sends 10 years TTL to users.

Please assist.

#2

That sure looks like 10 years. If it’s a bug, open a Support Ticket:
Login to Cloudflare and then contact Cloudflare Support

#3

I’m seeing 30 minutes…

< cf-cache-status: HIT
cf-cache-status: HIT
< cache-control: public, max-age=1800

#4

I should have taken a screenshot. Something that looked cache-related calculated out to 10 years.

#5

We updated our server configuration to set expires to 1800 seconds.
The bug is opened with screenshots of the problem.

cscharff, I you need, I can easily create another simple demo server to demonstrate the problem.

#6

Sure if you don’t mind. I’m technically not in support so my time to troubleshoot is a bit sporadic, but happy to take a look.

2 Likes
#7

I’ve setup a very simple test to demonstrate the problem:

https://codeit.ai/alex.gerasimov/juss24/cloudflare-bug/ - page that sets cache-control
max-age and related headers to 315360000
https://cloudflare-bug.duzyiod.com/alex.gerasimov/juss24/cloudflare-bug/ - page that is reverse-proxied using Cloudflare with page rules “Browser Cache TTL: 30 minutes, Cache Level: Cache Everything”

Thank you for your help!

#8

Can you try setting origin cache control as off and see if that makes a difference?

1 Like
#9

Sure, if I set origin cache control off or less than 30 minutes, it works fine: gets overwritten with 30 minutes.
This bug only appears for any origin values > 30 minutes.

#10

Ah so just had a discussion internally… with that setting we will return either the setting you have (30 minutes) or the value from the origin, whichever is higher. So in this case since you’re sending a max-age of 10 years we’re returning that. I believe you could work around this by sending s-max-age of 10 years and then either a shorter max-age or (I assume without an explicit max age we’d use your 30 mins).

#11

Thank you a lot, I’ve googled about s-max-age, and found the following article:

Thank you, this is exactly our case where we need to ask Cloudflare to cache page for a very long period of time (as soon as they change extremely rare in our case), but want to prevent local browser caching problems if/when we need change something.

Anyway I think current behavior looks not straightforward and definitely looks like bug or at least should be documented.

Thanks again, will play with it tomorrow!

closed #12

This topic was automatically closed after 30 days. New replies are no longer allowed.