Hi. I saw Page Rules are planned to be deprecated and wanted to create my new rule as a Redirect Rule.
The Page Rule would work as intended using the following syntax:
I cannot get anything to work to accomplish the same using a Redirect Rule. I found a similar suggesting using concat and http.request.uri.path, but this is not applicable in my scenario.
Yes, Cloudflare has said that for a while and they actually might deprecate it at some point, but I would not assume this is going to happen any time soon, meaning in the next half a year or year.
Personally, I would go with the page rule.
Of course, at some point you might have to migrate, but they might also deprecate everything else
@sandro , thanks for the response. Should I assume based on your response that the same functionality is not possible with a Redirect Rule?
If you are on a Business plan, you could try to play with
regex_replace. That may work, but I’d still argue page rules are more elegant for your use case.
This would be the equivalent redirect rule:
concat("https://example.com/page2/?utm_source=foo¶m_xyz=", substring(http.request.uri, 18))
Will immediately break with
Why? That matches neither the original page rule nor the redirect rule.
Because you never have a guarantee which parameters are provided and in which order.
There simply is no point in implementing this via a hack with
concat if you have an elegant solution with page rules -
In short, it is possible to somewhat implement that and the OP already referred to it in his original posting, but that would be a very static implementation and a single character will break the whole thing.
If the OP is on a Business plan, he could still implement it, but again, page rules are the easier, more elegant, and more stable approach and work on all plans.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.