Name: Rule 2
Order: 2
Rule: (ip.src.country ne “GB” and ip.src.country ne “US” and ip.src.country ne “FR” and ends_with(http.host, “.example.com”))
Action: Block
This should in theory allow traffic to the root domain for those locations specified in the rule, and block all other. The second rule to process should then prevent traffic from all but ‘GB’ ‘US’ and ‘FR’ for all subdomains.
Traffic allowed by rule one is being blocked (I can’t access from France)
Traffic blocked by rule two is being allowed (I can access for Australia)
I’m not getting upset. I just added the exclamation marks to emphasis that despite the rule in place the site is not blocking access for two quite concerning countries.
I have checked from various VPNs and:
(1) I cannot access the root domain from countries listed in the rule (which are to be allowed)
(2) I can access subdomains from countries I should not be able to (ie russia/china)
You’re accessing your subdomain with an IP from France, but your second rule only allows IPs from Ireland, Netherlands and United Kingdom to access it.
The first rule don’t block France, but the second block it.
You’ll need to allow France to access your website’s subdomain too.
Main domain and sub-domains are both proxied or some of them are unproxied (DNS-only)?
Try using Hostname contains then write and/or rather list sub.example.com, otherwise you’ve got multiple subs to cover, then write multiple of them is in and trigger such Custom WAF Rule?
Furthermore, you could use combination where you triger X and allow it for example.com but not sub.example.com in 1st rule, while trigger Y and block it for sub.example.com while example.com for such request is normally allowed as required.
Or even to combine in 3 rules, where last one is a “catch-all” example.
E.g. Allow requests from Croatia and Germany to example.com don’t allow them to go to the portal.example.com sub-domain … http.host ne "portal.example.com" and http.host contains "example.com" and ip.src.country in {"HR" "DE"}
Then in 2nd rule you go to cover what you need, and 3rd one to catch all those which aren’t triggered by those two.
Looking at the request URL it wasn’t a subdomain they tried to access from France, it was the route domain www.example.com and so therefore should have been allowed?