How do I exclude a specific URL from Cloudflare's caching?

You can exclude certain urls from Cloudflare's caching by using a feature called Page Rules. You can get to Page Rules by going to: settings->Page Rules.

The first step to using Page Rules is to define a pattern that defines when the rule is triggered. These patterns can be simple, such as a single URL, or complicated including multiple wildcards. Imagine you have a content management system with a single administrative URL:

    https://www.example.com/admin.php


If you want Cloudflare's performance and caching options off for this URL, then you would turn off the options using the drop down menus or toggles for the various Cloudflare features.

Wildcard and Advanced Pattern Matching

The pattern above will only match the following URL:

    https://www.example.com/admin.php


It will not match any of the following URLs:

    http://www.example.com/admin.php  [http ≠ https]
    https://example.com/admin.php  [missing www subdomain]
    https://www.example.com/admin  [admin ≠ admin.php]


You can make rules more flexible by including wildcards with the * character. For example, if you wanted the pattern to match all four of the above URLs, you could use a pattern like:

    *example.com/admin*

A wildcard can represent zero or more characters and can be used anywhere in the pattern. So, for example, the following pattern:

    https://www.example.com/*b*/*

Would match:

    https://www.example.com/blog/
    https://www.example.com/blog/index.php
    https://www.example.com/b/admin/folder/index.php
    https://www.example.com/myblog/

But would not match:

    https://www.example.com/blog  [missing the trailing slash]
    https://www.example.com/sam/index.php  [sam doesn't contain a "b"]

Please note: Page Rules are applied in the order that they are listed. If you want to change the position of a Page Rule, you can drag it up or down using the icon on the left hand side.

For a full Page Rule tutorial, visit this article.

Still not finding what you need?

The Cloudflare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.

Powered by Zendesk