About the priority of redirect rules and WAF rules
What steps have you taken to resolve the issue?
Set WAF rules to block attacking IP
Was the site working with SSL prior to adding it to Cloudflare?
Yes
What is the current SSL/TLS setting?
Full
What are the steps to reproduce the issue?
This is about my website, which was attacked. I set up WAF rules but they didn’t work.
Because I also set up redirection and Configuration Rules, but the priority of WAF is not high.
So my question is, is there a way to enable both Configuration Rules or redirection rules and WAF Rules?
Due to incorrect priorities, my WAF rules did not take effect on the subdomains that had Configuration Rules and Redirect Rules set, which made my website unable to defend against attackers.
Do you have any good suggestions or methods that can allow me to take effect on two rules at the same time and follow the WAF priority rule as the highest?
If a rule results in a terminating action, the request is stopped at Cloudflare and doesn’t consume any of your origin resources. Block actions or redirects do this.
Obviously the redirect target itself needs protection.
Any match and action due to a non-terminating rule will continue through the Cloudflare pipeline so the WAF being after Redirect and Configuration rules doesn’t matter, all will get executed unless a terminating action is triggered.
Obviously, WAF rule configuration and redirection rule configuration are not at the same level, and I cannot actively set their order.
I enabled WAF rules for the entire domain, which means that both subdomains and workers will follow this rule, but it is obvious that even though the domain after the redirection rule belongs to my domain and WAF is enabled, the WAF rule is not executed.
My redirection rules are:
For backend.bfban.com, perform a 301 redirect and carry request parameters
My Configuration Rules are
For backend.bfban.com, select SSL/TLS encryption mode as Full (others are Flexible)
If the rule was working, no further rules for backend would do anything as requests have already been redirected and rules should instead act on api for when the redirected request is made.
Ensure your origin has working SSL and only use “Full (strict)” in all cases otherwise your connections are not secure.
Thanks for your reply, I think I found the cause of the problem (maybe)
When you set redirection and WAF rules for the same subdomain, you may need to set WAF rules first, then set redirection rules. When I tried to modify these rules, deleted and re-filled them, everything seems to be normal now.
The specified blocked IP list is in effect, they will follow the redirection first (maybe not) and then be responsible for the WAF rules.