Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Network level ad-blocking doesn't work very well.

Privoxy (and Proxomitron before it) were doing it 20 years ago, but never caught on because they're a PITA to setup and can't handle inline adverts. Pi-hole is new, but it's even more work to setup, and suffers the same limitations.

And as ad-blocking has become more popular the problems only gotten worse. It's unusual that I see any ads any more, but when I do it's always in an inline div or span with a "random" id or class name, essentially invisible to pi-hole.



I still use Proxomitron. It's as powerful as the filters you write for it, works across all browsers (including the "hidden" ones embedded in apps and such), and the community has made patches that let you MITM TLS as well using OpenSSL (although the certificate setup needs a bit of planning and understanding.)

The only downside is that its filtering language is regex-like, so basically the equivalent of "two netcats and a sed". I've contemplated writing a filter proxy that would parse HTML into a DOM, run filtering on that tree-structured representation using something XPath or XSLT-ish, and then reserialise the modified HTML to send to browsers, but never had the time to. I suspect performance wouldn't be great with such a setup, although with MITM TLS it's already doing a double-encrypt-decrypt and I don't find that slowing me down noticeably.


Why doesn't it? (Not a leading question, I just don't understand why it doesn't) Isn't the way uBlock and the like work is that they see network requests from a blacklist and not load those resources? Isn't network level blocking just moving that from the local device up a level?


They do (well partly), but with network level blocking you end up with broken DOM elements (like images, videos, etc.) The good think about the browser extensions is that they clean up the DOM and in many cases you wouldn't even know if the pages had ads.

Then there's also Javascript trickery loaded with the page that do hostile things if ad servers aren't reachable, and extensions know how to detect and replace them.

I think the closer the blocker is to the user, the higher the fidelity of the blocking.


A browser extension has access to the actual requests, while all a network level blocker has is the Server header of a TLS packet at best, just an IP with SNI encryption at worst. That's why PiHole works as a DNS proxy by only properly responding to non-blacklisted hosts with a proper DNS response, but even this might be useless in some cases due to "domain fronting".


A PiHole only sees the DNS request, which works fine if ads are served from a separate hostname like ads.mydomain.com. But if they're served from the same sub-domain and simply have a different URL (ie, mydomain.com/ads/[...]), then the PiHole won't block it. uBlock/ABP will, because they can filter on entire URLs, not just the domain.


uBlock (and AdBlock Plus) can access and prune/block individual DOM elements, and even has a built-in tool (the eye dropper icon) to select and block them. I think they call it "cosmetic filters". It's also available in the right-click context menu under "Block element".

I don't know exactly how it works under the hood, though. If I block a div with text in it, I know the div is still downloaded, just not displayed. I don't know what happens in more complicated cases, like if I block a div that contains an img tag. I think it's smart enough to prune the img tag before the browser downloads it, but IDK for sure.

I vaguely recall Privoxy having some kind of content filtering, but when I tried it, it wasn't html/css/javascript aware, and only did regex based replacement.


I guess I am missing something. I have a Pi-Hole setup at both home and office that serve as the only DNS for the entire network at both locations. I don't see ads, affiliate links don't resolve, and tracking/monitoring services don't capture my traffic.

My experience has been that it took about 30 minutes to setup and I don't see ads on the internet, nor do my family or team.


I can’t speak for pi-hole, but Diversion on Asuswrt-Merlin works fantastic for me. No ads ever except for YouTube ads lately due to google’s changes to how they serve ads from the same servers they provide services on.


> No ads ever except for YouTube ads lately due to google’s changes to how they serve ads from the same servers they provide services on.

Thats what I meant by network level blocking doesn't work very well. Using uBlock Origin, I don't see YouTube ads.


There's a huge difference between "doesn't work very well" and "works perfectly except for one really sneaky ad company, sometimes". How does ublock origin cover scripts and ads for my entire network? Did you even look at what I'm talking about before making such general statements? My router blocks hundreds of thousands of incidents per week, and there are only two people in my household. One can't use a browser plugin on android tv, Apple TV, smart tv, and a million other devices. By your own logic, ublock origin doesn't work very well. See what I mean?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: