Blocking Facebook’s Like Button with Squid

So, I read this story today, which says the following:

Even if someone is not a Facebook user or is not logged in, Facebook’s social plugins collect the address of the Web page being visited and the Internet address of the visitor as soon as the page is loaded–clicking on the Like button is not required. If enough sites participate, that permits Facebook to assemble a vast amount of data about Internet users’ browsing habits.

Well, that’s creepy. Even though I deleted my Facebook account, they’re still trying to collect information about me by embedding themselves in other websites. Well, that happens to be really easy to fix for my entire network running through a Squid proxy server:

# Facebook Like Button Denial
acl facebook dstdomain .facebook.com
acl facebook_like urlpath_regex -i ^\/plugins\/like\.php
deny_info error-facebook-like facebook_like
http_access deny facebook facebook_like

I also had to create this file in my error_directory: /usr/share/squid/errors/en/error-facebook-like

<p>This just in: <b>Facebook Sucks.</b></p>

Now, when I go to a site with a Like button on it, it looks like this:

But Kelsey can still get to her beloved Facebook directly! Thanks, Squid team.


3 thoughts on “Blocking Facebook’s Like Button with Squid

  1. Salmonella.dk

    Nice one…using it to block like url.
    THX
    Getting back at them.
    :twisted:
    Using dansguardian with squid, you can replace all instances of “Facebook” with “Foolbook” pretty easy :
    in /etc/dansguardian/lists/contentregexplist insert 2 lines

    “Facebook”->”Foolbook”
    “Foolbook.com”->”Facebook.com”

    with this users can still surf facebook.

  2. immux

    nice.. i try to modify and add some for this
    acl facebook_like_plugin urlpath_regex -i ^\/plugins\/like\.php
    acl facebook_like_widget urlpath_regex -i ^\/widgets\/like\.php

  3. JZS

    This is an old but very helpful thread for those plagued by FB Like Button. It’s now popping up everywhere and in places where there isn’t enough (good) space for error text. To simply delete the Button silently (i.e., without error text), try:

    deny_info TCP_RESET facebook_like

Leave a Reply

Your email address will not be published. Required fields are marked *