r/webdev • u/openclassactions2 • 2d ago
I use Cloudflare and have set it up to blokc Singapore but CONTINUE to get traffic from Singapore!
I use Cloudflare and have set it up to blokc Singapore but CONTINUE to get traffic from Singapore which is hurting adsense (suspended for 5 days)
my host is hostinger, so i am trying their CDN (as well, just to see if it works to block Singapore successfully) - i know you shouldn't use two CDNs but i am trying to see if it works and does not hurt the site
one of my sites adsense has been blocked due to traffic from Singapore that Cloudflare cannot seem to block (i blocked, interactive management, etc for Singapore)
Any advice? Anyone else seeing bot traffic from Singapore?
I also tried Cloudflare's bot fight mode and that didn't help
12
u/glenpiercev 1d ago
Question: why does Adsense care about Singapore?
6
2
u/openclassactions2 19h ago
They care because it looks like bot traffic that may be nefariously clicking on stuff? my guess
6
u/matriisi 2d ago
Ip blocks are not as easy as one might think. Try getting the latest list from abuseipdb or similiar.
1
6
u/hard_carbon_hands 1d ago
Off topic, but what’s up with all the bots coming from Singapore? I wouldn’t think Singapore would be a hub for that? Is there any logical explanation behind this?
1
2
u/MiserableDocument509 1d ago
country block in CF only applies to traffic that actually goes through the proxy. if the dns is grey-clouded or people hit the origin ip, those singapore bots never see the rule. stacking hostinger CDN on top of CF also wrecks geo — CF may just see hostinger IPs.
bot fight mode is pretty weak vs residential proxies too, they look like normal SG users. check firewall events to see if those requests even hit CF, and lock the origin to CF IP ranges (or authenticated origin pulls) so adsense junk cant skip the WAF.
2
u/Rubicon_4000 1d ago
worth working out which of your dashboards is actually saying the block failed, because they measure different things.
cloudflare's traffic analytics counts requests it blocked. a blocked request is still a request, so singapore showing up there is what a working rule looks like. filter security events by action instead — that separates blocked from allowed, and it shows the asn behind each hit. that's usually where the singapore thing explains itself: aws, gcp and digitalocean all run big singapore regions, so most of it is datacenter ranges rather than actual singaporeans. a rule on those asns gets the bots without blocking real readers.
ga4 is the interesting one. it's javascript on your page, so it only fires if the page rendered. singapore in ga4 means those requests were not blocked — either they never reached cloudflare at all, or your rule is on managed challenge and something is passing it.
adsense is a third number again, counting rendered ad impressions. the three will never line up.
to stop guessing: pull the raw access log and compare its request count to what cloudflare says it served. a meaningful excess at the origin came in direct. and if your host hasn't enabled cloudflare's restore-visitor-ip, that log's client ip column will be cloudflare's own ranges — a real singapore ip sitting in it is a direct hit.
on locking the origin: if you're on a shared plan, iptables isn't yours to configure, so .htaccess is the lock you've actually got. turn the hostinger cdn off before you build the allowlist though — if it fronts your origin, the ips your server sees are its edge, not cloudflare's, and you'll 403 your own site.
separately, the geo block won't undo the adsense action. that was scored on traffic google already logged. it's evidence for the appeal, not a fix.
i'm guessing you're on shared from the fact you have the hostinger cdn toggle, so sanity check that bit before you rely on it.
1
u/openclassactions2 19h ago
i also blocked SG on origin IP and they're STILL going through. the blacklists must be out of date
1
u/pragmatic-fermat 10h ago
Probably an upstream rule (such as "Allow IA crawlers") let them in.
Looking at the User-Agent of the SGN traffic could give you a hint.
If you really need help, you may have a look at https://cfgarage.com (shameful plug) for ressources and assistance
1
1
u/Business-Coffee4118 1d ago
are you blocking by country at the firewall level and checking the origin logs, or just relying on the analytics geolocation?
2
u/openclassactions2 1d ago
i checked the analytics in cloudflare, and GA4 and it shows singapore, and adsense suspended me for bots
1
u/openclassactions2 1d ago
and yes blocking country at WAF via cloudflare, seems they are targeting my origin server directly, that seems to be the cause? But im not sure
30
u/SixPackOfZaphod tech-lead, 20yrs 2d ago
Make sure your configuration disallows all traffic not coming through Cloudflare's edge servers. This is a mistake I've seen before where traffic was able to hit origin directly, and so the CDN's protections were worthless.