• Resolved p15h

    (@prestonwordsworth)


    Dear Majumder

    Facebook’s fbclid query string bypasses CF cache by default, resulting in a lower HIT ratio. APO’s solution for this is to create an allowlist of query parameters where cached content is served.

    I was wondering if you think it is possible to do a recipe replicating this particular functionality – for instance, by leveraging CF Workers available on the free plan.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @prestonwordsworth,
    You can just take advantage of the new cache rule compatibly system this plugin provides. Check: https://gist.github.com/isaumya/af10e4855ac83156cc210b7148135fa2

    Thread Starter p15h

    (@prestonwordsworth)

    Yes, I was alluding to this earlier recipe from you! But Facebook’s fbclid query string keeps bypassing the cache even after toggling on ‘Ignore query string’ both in that cache rule and under Caching —> Configuration panel.

    I suppose that’s why APO has to maintain an allowlist (above) in order to serve cache for these strings, which bypass cache by default even when choosing ‘Ignore query string’.

    We may have to do a bit of extra work to replicate the functionality of that allowlist?

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @prestonwordsworth,

    1. When using this plugin you need to make sure that the default Cloudflare plugin is disabled in your WP site and also APO is disabled from the CF dahboard
    2. If you implement the cache rules as mentioned here, after implementing the Rule 4, the cache bypass issue for the facebook or any of those unnecessary query params will be fixed. Cloudflare will simply ignore those query params from the cache key generation. Screenshot: https://i.imgur.com/Px9Ze4c.jpeg
    3. The allow list you are talking about, can be easily implemented by adding the query params for which you want to bypass cache in the Cache Rule. For example if you look at the Cache Rule 4, you will see that the WP default search query param (s) is already bypassed from cache: https://i.imgur.com/PntFnya.jpeg
    Thread Starter p15h

    (@prestonwordsworth)

    Dear Majumder

    Many thanks for this!

    I’m afraid I utterly failed to get my point across. Let me try again if you’ll bear with me:

    The trouble with ‘?fbclid=‘ isn’t that it can’t bypass CF cache, it’s that it still bypasses CF cache even after Rule 4 gets implemented. That is, it always bypasses cache whatever we do in the CF zone dashboard.

    The APO doc I linked to has this to say:

    APO serves cached content as long as the query parameters in the URL are one of the following

    This seems to indicate that their allowlist isn’t intended to let these query parameters (including fbclid) bypass CF cache. On the contrary, the allowlist stops them from bypassing cache precisely because Rule 4 alone is unable to achieve this.

    This would explain why we repeatedly observed queries with parameters like ‘?fbclid=‘ in our access log even though we’d already implemented Rule 4. (FYI, we don’t have CF’s default plugin installed on our site.)

    I hope I’ve made it a bit clearer?

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @prestonwordsworth,
    If you have implemented all the Cache Rules as mentioned in the guide and also made sure that the official CF plugin and APO is disabled then this should not happen. Can you share a screenshot of all the cache rules you have and also the page rules you have. Also share a URL of any article so that we can test things here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Recipe for query parameters allowlist?’ is closed to new replies.