Initially I did not find the need for a web proxy, I have got quite a number of computers at home but why a proxy ?

The answer is: because Safari for iOS has not f*cking way to filter ads ! And when you are used to AdBlock seeing ads everywhere is ... annoying.

Before going for the proxy, I searched for alternatives. One of the recommended setup seems to be using adsuck, a small DNS server that spoofs blacklisted addresses (blocking ads at the domain name level). As I am using my ISP box as DHCP server, I am also using its DNS servers so switching to my internal DNS server will required a bit of work and ... sometimes I am a lazy guy :)

Then I looked for privoxy a well known ads blocker proxy, but it is not a light, simple and small one.

So I looked for a small proxy (with URL filtering) and I found Tinyproxy written in C and available as an OpenBSD package. The code is easy to read (I have got a few ideas to patch in but my spare time is running low ...).

I installed it, configured it (not really a lot of things to change from default, just enable filtering with "FilterURLs On").

Then you need to fill the filtering file containing all the blocked URL patterns. I did not find non bloated ad pattern lists so I build my own by browsing my usual websites with my iPad and looking at the URL in tinyproxy logs (you may need to change the log level in tinyproxy conf file).

Finally my filter file looks like this:

http://ads\.
http://ad\.
googleads\.
\/ads\/
partner\.googleadservices\.com
\.admob\.com
iadc\.qwapi\.com
iadsdk\.apple\.com
connect\.decknetwork\.net
\/ad-feed\/
w\.inmobi\.com
\.scorecardresearch\.com
\.adserverpub\.com

This list is obviously targeted toward mobile ads but it is a good start if you are trying to do the same.

Bonus point: it also block ads in the apps ! (you are still loosing the space but a blank space is less aggressive than a blinking groupon ad).

And I found another use to this proxy: when you are working in a place where half of the Internet is denied for some unknown reason you can surf through a SSH tunnel :)

PS: If you have any good ad patterns I can add to my file, just post it in comments !