• Resolved ofmarconi

    (@ofmarconi)


    Hi!

    I know it’s possible with Workers, but I think it’s also possible with Rewrite Rules, correct?

    See this rule I created: https://i.postimg.cc/zXCCG0Cy/image.png

    It ignores all queries that exist “fbclid”

    In my tests every time it gave HIT.

    Can you confirm if this is correct? If yes, implement it in your plugin ??

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

    (@isaumya)

    Can you confirm if this is correct? If yes, implement it in your plugin

    – first of all this is not dully correct or fully wrong. Let me explain further.

    The first problem is you did if URI contains fbclid then remove the query string. Which is right is your case but can be wrong in many other cases. As an example if your URI is something like https://example.com/what-is-fbclid/?fbclid=123 then it will output https://example.com/what-is-fbclid/ but what if you have a bunch of other query params attached to it which you would like to keep.

    For example imagine an URL like https://example.com/what-is-fbclid/?fbclid=123&foo=bag&selected_item=123 in this case you would like to remove the fbclid while keeping the other query params intact.

    Now this would only be possible with the help of Regex (Regular Expressions) which is only available for Cloudflare Business and Enterprise plan users.

    So, using the worker which also has 100,000 requests/day for free and after that charges a very nominal cost – would provide much better value as it is not only handling the URL query params properly with regex but also has a much better cache bypass logic which works really great for eCommerce sites. Also with workers, there are no cache buster query string. So, it’s a win-win-win everywhere.

    ———————-

    Now coming to what’s the best possible Cloudflare Transform Rule for handling query parameters, here is what I will suggest –

    Rule Name: Remove Unnecessary Query Params

    When incoming requests match…
    Field: URI Query String
    Operator: Matches Regex
    Value:
    (fbclid|fb_action_ids|fb_action_types|fb_source|_ga|age-verified|ao_noptimize|usqp|cn-reloaded|klaviyo|gclid|utm_source|utm_medium|utm_campaign|utm_content|utm_term|ref|utm_term|hemail|amp)=[a-zA-Z0-9]+

    Then
    Rewrite
    Path: Preserve

    Query
    Rewrite to: Dynamic
    Value:
    regex_replace(http.request.uri.query, "(fbclid|fb_action_ids|fb_action_types|fb_source|_ga|age-verified|ao_noptimize|usqp|cn-reloaded|klaviyo|gclid|utm_source|utm_medium|utm_campaign|utm_content|utm_term|ref|utm_term|hemail|amp)=[a-zA-Z0-9]+", "")

    Screenshot: https://i.imgur.com/NM8bUou.jpeg

    P.S.: Regex match is only available for Cloudflare Business and Enterprise plan users.

    ——————

    Alternatively, if you use the Transform Rule the way you are using – as I said before it will lead to removing all query param when one of them is present. So, if you are sure that you will never have situations like where you will have both query params like fbclid which you would like to remove along with other query params that you would like to keep. Then you can definitely do what you are doing.

    But again this will not be done automatically by the plugin for everyone as there might be sites whose use cases are not that simple and they might need to remove certain query params while keeping the others. So, the worker option is still the best.

    Thread Starter ofmarconi

    (@ofmarconi)

    Wow! Your answers will always be the best of all .org support, thank you for writing a post about it ??

    Always enlightening!

    • This reply was modified 2 years, 4 months ago by ofmarconi.
    Plugin Contributor iSaumya

    (@isaumya)

    Haha! Thank, @ofmarconi but it seems some people still feel otherwise ??
    Link: https://www.ads-software.com/support/topic/no-support-532/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘fbclid can be ignored using Rewrite Rules instead of Paid Workers.’ is closed to new replies.