Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using owncloud and sometimes share links with people via Facebook.

I am concerned with automatic crawling, so I would like to deny facebook access to my owncloud.thomas-steinbrenner.net server (it visits all links in order to get preview pictures, preview texts, etc.)

Is there a way to do this in nginx? Like via hostname or agent? (I feel like using IPs is a game one cannot win).

If not: Is there some other way like a blacklist project with a list of gov-, FB-, etc. -IPs for iptables?

share|improve this question
    
If I understand correctly you need only block the referer try something like this –  user Jul 5 '13 at 11:57

2 Answers 2

tcp wrappers? I believe that can do host/domain based denies. Also have you tried a simple robots.txt would be surprised if facebook didn't respect them. I'd think they could not afford the controversy of ignoring them.

share|improve this answer

nginx supports the $http_user_agent value out of the box:

if ($http_user_agent ~* (facebook|google)) {
   ...
}

Hostname verification can be done via 3rd party module — ngx_http_rdns_module: http://wiki.nginx.org/HttpRdnsModule (https://github.com/flant/nginx-http-rdns)

Like this:

location / {
    rdns double;
    rdns_deny ^.*\.(facebook|google)\.com$;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.