How to DISABLE PDF Caching

We use Cloudflare Pro in front of a web application. This web application generates reports for users on demand in PDF format. Problem is one user can generate one report. and a second user can generate the same report with slightly different criteria (like date range), and the first report is cached and served to the second user. We can turn this behavior off by turning on Development Mode, but that only lasts about 3 hours. Is there a way to permanently turn off caching of PDFs in Cloudflare Pro version?

Try a Page Rule:


Thank you. We spent a couple days trying different configurations of Page Rules with no success. Our financial application creates all reports in PDF format. It dynamically creates a URL for that users session and presents PDF reports through it. If the same report is rerun with different criteria, Cloudflare serves out the previously cached report instead of the new one. URL structure is like this:

The /DOCS_1201105018/ part is dynamically generated and changes with each logon. We have attempted multiple ways of configuring page rules to exclude PDF caching with no success due to the dynamically changing URL structure. The last version we tried is:*.PDF

What are we doing wrong?

The page rule I posted, as formatted, will work. I’ve just tested it on my own file

Thanks again. Still not working. I tried:

and so many other permutations I lost track, and it always caches unless I turn on Development Mode. Then it works correctly for 3 hours until Development Mode expires. The other workaround that works is to have a user run the report, log out, log back in, and run with new criteria, and repeat.

I have typos above. They are all *.pdf, not .pdf

Can you post a screenshot of all your Page Rules? Again, I tried the page rule I posted and it worked as described.

1 Like

Would you be interested in a quick consulting gig to help with this?

Only one page rule will match, and the first page rule with a matching URL will be the only rule that is used. It looks like the fourth rule will match, and set the SSL mode. The sixth rule will never be matched.

You need to change the sixth rule to include the SSL mode setting, and move it above rule four.

And before anybody else tells you, Flexible is not safe, and you should take the few minutes needed to fix that.

You can probably also just use the Always Use HTTPS setting on the SSL/TLS tab of the dashboard, and turn off the individual page rules you have set for that setting.


Thank you Michael. Moving the sixth rule above the fourth worked. I’m new to Cloudflare with this being the first install, and I really appreciate all of you who helped. I’ll look into the Flexible, first time for that too. Always used SSL certs before.

1 Like

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